OSDN Git Service

cifs: Use GFP_ATOMIC when a lock is held in cifs_mount()
authorYueHaibing <yuehaibing@huawei.com>
Tue, 18 Dec 2018 01:34:39 +0000 (01:34 +0000)
committerSteve French <stfrench@microsoft.com>
Fri, 28 Dec 2018 16:13:11 +0000 (10:13 -0600)
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 <yuehaibing@huawei.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Reviewed-by: Paulo Alcantara <palcantara@suse.de>
fs/cifs/connect.c

index ef51cf7..8de2173 100644 (file)
@@ -4585,7 +4585,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;