]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
cifs: fix leak in FSCTL_ENUM_SNAPS response handling
authorDavid Disseldorp <ddiss@suse.de>
Wed, 3 May 2017 15:39:09 +0000 (17:39 +0200)
committerSteve French <smfrench@gmail.com>
Wed, 3 May 2017 14:54:12 +0000 (09:54 -0500)
The server may respond with success, and an output buffer less than
sizeof(struct smb_snapshot_array) in length. Do not leak the output
buffer in this case.

Fixes: 834170c85978 ("Enable previous version support")
Signed-off-by: David Disseldorp <ddiss@suse.de>
CC: Stable <stable@vger.kernel.org>
Signed-off-by: Steve French <smfrench@gmail.com>
fs/cifs/smb2ops.c

index 152e37f2ad9213462a2ae439296a6edb49d653f9..c58691834eb2b74fa34f3fe2661ed3e211c4d22e 100644 (file)
@@ -942,6 +942,7 @@ smb3_enum_snapshots(const unsigned int xid, struct cifs_tcon *tcon,
                }
                if (snapshot_in.snapshot_array_size < sizeof(struct smb_snapshot_array)) {
                        rc = -ERANGE;
+                       kfree(retbuf);
                        return rc;
                }