diff options
author | Ross Lagerwall <ross.lagerwall@citrix.com> | 2019-01-08 18:30:57 +0000 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2019-01-11 07:14:40 -0600 |
commit | b9a74cde94957d82003fb9f7ab4777938ca851cd (patch) | |
tree | ccd9808334e6bc7ab6d53193aa7590f69de830ab /fs/cifs/smb2file.c | |
parent | 92a8109e4d3a34fb6b115c9098b51767dc933444 (diff) | |
download | linux-stable-b9a74cde94957d82003fb9f7ab4777938ca851cd.tar.gz linux-stable-b9a74cde94957d82003fb9f7ab4777938ca851cd.tar.bz2 linux-stable-b9a74cde94957d82003fb9f7ab4777938ca851cd.zip |
cifs: Fix potential OOB access of lock element array
If maxBuf is small but non-zero, it could result in a zero sized lock
element array which we would then try and access OOB.
Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
CC: Stable <stable@vger.kernel.org>
Diffstat (limited to 'fs/cifs/smb2file.c')
-rw-r--r-- | fs/cifs/smb2file.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/cifs/smb2file.c b/fs/cifs/smb2file.c index eff01ed6db0a..b204e84b87fb 100644 --- a/fs/cifs/smb2file.c +++ b/fs/cifs/smb2file.c @@ -122,10 +122,10 @@ smb2_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock, /* * Accessing maxBuf is racy with cifs_reconnect - need to store value - * and check it for zero before using. + * and check it before using. */ max_buf = tcon->ses->server->maxBuf; - if (!max_buf) + if (max_buf < sizeof(struct smb2_lock_element)) return -EINVAL; BUILD_BUG_ON(sizeof(struct smb2_lock_element) > PAGE_SIZE); |