Skip to content

Commit

Permalink
CIFS: Fix a possible memory corruption in push locks
Browse files Browse the repository at this point in the history
If maxBuf is not 0 but less than a size of SMB2 lock structure
we can end up with a memory corruption.

Cc: Stable <[email protected]>
Signed-off-by: Pavel Shilovsky <[email protected]>
  • Loading branch information
piastry committed Dec 5, 2016
1 parent 4772c79 commit e3d240e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/cifs/smb2file.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ smb2_push_mandatory_locks(struct cifsFileInfo *cfile)
* and check it for zero before using.
*/
max_buf = tlink_tcon(cfile->tlink)->ses->server->maxBuf;
if (!max_buf) {
if (max_buf < sizeof(struct smb2_lock_element)) {
free_xid(xid);
return -EINVAL;
}
Expand Down

0 comments on commit e3d240e

Please sign in to comment.