]> www.infradead.org Git - users/willy/pagecache.git/commitdiff
ksmbd: fix bug on trap in smb2_lock
authorNamjae Jeon <linkinjeon@kernel.org>
Thu, 27 Feb 2025 06:49:10 +0000 (15:49 +0900)
committerSteve French <stfrench@microsoft.com>
Mon, 3 Mar 2025 04:50:53 +0000 (22:50 -0600)
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: stable@vger.kernel.org
Reported-by: Norbert Szetei <norbert@doyensec.com>
Tested-by: Norbert Szetei <norbert@doyensec.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/server/smb2pdu.c

index 35bed8fc1b97019a910993eb3dc63869e7a37f9a..c53121538990ecaaa3867c670085ca09f8da1a97 100644 (file)
@@ -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) {