Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 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>

authored by

Namjae Jeon and committed by
Steve French
e26e2d2e 84d2d164

+1 -1
+1 -1
fs/smb/server/smb2pdu.c
··· 7468 7468 retry: 7469 7469 rc = vfs_lock_file(filp, smb_lock->cmd, flock, NULL); 7470 7470 skip: 7471 - if (flags & SMB2_LOCKFLAG_UNLOCK) { 7471 + if (smb_lock->flags & SMB2_LOCKFLAG_UNLOCK) { 7472 7472 if (!rc) { 7473 7473 ksmbd_debug(SMB, "File unlocked\n"); 7474 7474 } else if (rc == -ENOENT) {