Skip to content

Commit e3d240e

Browse files
committed
CIFS: Fix a possible memory corruption in push locks
If maxBuf is not 0 but less than a size of SMB2 lock structure we can end up with a memory corruption. Cc: Stable <stable@vger.kernel.org> Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
1 parent 4772c79 commit e3d240e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/cifs/smb2file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ smb2_push_mandatory_locks(struct cifsFileInfo *cfile)
260260
* and check it for zero before using.
261261
*/
262262
max_buf = tlink_tcon(cfile->tlink)->ses->server->maxBuf;
263-
if (!max_buf) {
263+
if (max_buf < sizeof(struct smb2_lock_element)) {
264264
free_xid(xid);
265265
return -EINVAL;
266266
}

0 commit comments

Comments
 (0)