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@xxxxxxxxxx> --- 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;