From patchwork Tue Dec 18 01:34:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yue Haibing X-Patchwork-Id: 1014915 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43JgNv2KHZz9s1c for ; Tue, 18 Dec 2018 12:27:11 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726276AbeLRB1K (ORCPT ); Mon, 17 Dec 2018 20:27:10 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:16582 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726260AbeLRB1J (ORCPT ); Mon, 17 Dec 2018 20:27:09 -0500 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 3B557FC0EB321; Tue, 18 Dec 2018 09:27:06 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.408.0; Tue, 18 Dec 2018 09:27:01 +0800 From: YueHaibing To: Steve French CC: YueHaibing , , , Subject: [PATCH -next] cifs: Use GFP_ATOMIC when a lock is held in cifs_mount() Date: Tue, 18 Dec 2018 01:34:39 +0000 Message-ID: <1545096879-123632-1-git-send-email-yuehaibing@huawei.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org A spin lock is held before kstrndup, it may sleep with holding the spinlock, so we should use GFP_ATOMIC instead. Fixes: e58c31d5e387 ("cifs: Add support for failover in cifs_reconnect()") Signed-off-by: YueHaibing Reviewed-by: Paulo Alcantara --- fs/cifs/connect.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index a83aa61..3d5e308 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -4574,7 +4574,8 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *vol) tcon->remap = cifs_remap(cifs_sb); } cifs_sb->origin_fullpath = kstrndup(tcon->dfs_path, - strlen(tcon->dfs_path), GFP_KERNEL); + strlen(tcon->dfs_path), + GFP_ATOMIC); if (!cifs_sb->origin_fullpath) { spin_unlock(&cifs_tcp_ses_lock); rc = -ENOMEM;