aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNamjae Jeon <[email protected]>2025-02-27 06:49:10 +0000
committerSteve French <[email protected]>2025-03-03 04:50:53 +0000
commite26e2d2e15daf1ab33e0135caf2304a0cfa2744b (patch)
tree62d1cbb8e32bbcbc4d02b44021155509b7fbf04a
parentksmbd: fix use-after-free in smb2_lock (diff)
downloadkernel-e26e2d2e15daf1ab33e0135caf2304a0cfa2744b.tar.gz
kernel-e26e2d2e15daf1ab33e0135caf2304a0cfa2744b.zip
ksmbd: fix bug on trap in smb2_lock
If lock count is greater than 1, flags could be old value. It should be checked with flags of smb_lock, not flags. It will cause bug-on trap from locks_free_lock in error handling routine. Cc: [email protected] Reported-by: Norbert Szetei <[email protected]> Tested-by: Norbert Szetei <[email protected]> Signed-off-by: Namjae Jeon <[email protected]> Signed-off-by: Steve French <[email protected]>
-rw-r--r--fs/smb/server/smb2pdu.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index 35bed8fc1b97..c53121538990 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -7468,7 +7468,7 @@ no_check_cl:
retry:
rc = vfs_lock_file(filp, smb_lock->cmd, flock, NULL);
skip:
- if (flags & SMB2_LOCKFLAG_UNLOCK) {
+ if (smb_lock->flags & SMB2_LOCKFLAG_UNLOCK) {
if (!rc) {
ksmbd_debug(SMB, "File unlocked\n");
} else if (rc == -ENOENT) {