Skip to content

Commit 6fc0a26

Browse files
namjaejeonSteve French
authored andcommitted
ksmbd: fix potential circular locking issue in smb2_set_ea()
smb2_set_ea() can be called in parent inode lock range. So add get_write argument to smb2_set_ea() not to call nested mnt_want_write(). Signed-off-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent bb05367 commit 6fc0a26

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

fs/smb/server/smb2pdu.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2311,11 +2311,12 @@ static noinline int create_smb2_pipe(struct ksmbd_work *work)
23112311
* @eabuf: set info command buffer
23122312
* @buf_len: set info command buffer length
23132313
* @path: dentry path for get ea
2314+
* @get_write: get write access to a mount
23142315
*
23152316
* Return: 0 on success, otherwise error
23162317
*/
23172318
static int smb2_set_ea(struct smb2_ea_info *eabuf, unsigned int buf_len,
2318-
const struct path *path)
2319+
const struct path *path, bool get_write)
23192320
{
23202321
struct mnt_idmap *idmap = mnt_idmap(path->mnt);
23212322
char *attr_name = NULL, *value;
@@ -3003,7 +3004,7 @@ int smb2_open(struct ksmbd_work *work)
30033004

30043005
rc = smb2_set_ea(&ea_buf->ea,
30053006
le32_to_cpu(ea_buf->ccontext.DataLength),
3006-
&path);
3007+
&path, false);
30073008
if (rc == -EOPNOTSUPP)
30083009
rc = 0;
30093010
else if (rc)
@@ -5992,7 +5993,7 @@ static int smb2_set_info_file(struct ksmbd_work *work, struct ksmbd_file *fp,
59925993
return -EINVAL;
59935994

59945995
return smb2_set_ea((struct smb2_ea_info *)req->Buffer,
5995-
buf_len, &fp->filp->f_path);
5996+
buf_len, &fp->filp->f_path, true);
59965997
}
59975998
case FILE_POSITION_INFORMATION:
59985999
{

0 commit comments

Comments
 (0)