Skip to content

Commit

Permalink
cifs: Use GFP_ATOMIC when a lock is held in cifs_mount()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Steve French <[email protected]>
Reviewed-by: Paulo Alcantara <[email protected]>
  • Loading branch information
YueHaibing authored and Steve French committed Dec 28, 2018
1 parent 93d5cb5 commit 2f0a617
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/cifs/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2f0a617

Please sign in to comment.