]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
CIFS: Fix a possible memory corruption in push locks
authorPavel Shilovsky <pshilov@microsoft.com>
Wed, 30 Nov 2016 00:14:43 +0000 (16:14 -0800)
committerSasha Levin <alexander.levin@verizon.com>
Fri, 13 Jan 2017 01:56:55 +0000 (20:56 -0500)
[ Upstream commit e3d240e9d505fc67f8f8735836df97a794bbd946 ]

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>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
fs/cifs/smb2file.c

index 2ab297dae5a7b2b4e544e3f35abc5f09b9fa7b1d..1bdfd7c5309c70baff58b2c7364fc6828e24c869 100644 (file)
@@ -241,7 +241,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;
        }