Skip to content

Commit 277627b

Browse files
Al Virosmfrench
authored andcommitted
ksmbd: fix a mount write count leak in ksmbd_vfs_kern_path_locked()
If the call of ksmbd_vfs_lock_parent() fails, we drop the parent_path references and return an error. We need to drop the write access we just got on parent_path->mnt before we drop the mount reference - callers assume that ksmbd_vfs_kern_path_locked() returns with mount write access grabbed if and only if it has returned 0. Fixes: 864fb5d ("ksmbd: fix possible deadlock in smb2_open") Signed-off-by: Al Viro <[email protected]> Acked-by: Namjae Jeon <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 0c2b539 commit 277627b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/smb/server/vfs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,6 +1282,7 @@ int ksmbd_vfs_kern_path_locked(struct ksmbd_work *work, char *name,
12821282

12831283
err = ksmbd_vfs_lock_parent(parent_path->dentry, path->dentry);
12841284
if (err) {
1285+
mnt_drop_write(parent_path->mnt);
12851286
path_put(path);
12861287
path_put(parent_path);
12871288
}

0 commit comments

Comments
 (0)