summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2019-05-17 09:12:33 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-06-09 09:17:22 +0200
commit32d57c0c063cdab6639da074e8b0f28517862e41 (patch)
tree0716bb99cc9d000931cad1000338ed96726cb192 /fs
parentf6a39f877feb5342aee6b7ca63a61ceedaa92be7 (diff)
downloadlinux-rpi3-32d57c0c063cdab6639da074e8b0f28517862e41.tar.gz
linux-rpi3-32d57c0c063cdab6639da074e8b0f28517862e41.tar.bz2
linux-rpi3-32d57c0c063cdab6639da074e8b0f28517862e41.zip
cifs: fix memory leak of pneg_inbuf on -EOPNOTSUPP ioctl case
commit 210782038b54ec8e9059a3c12d6f6ae173efa3a9 upstream. Currently in the case where SMB2_ioctl returns the -EOPNOTSUPP error there is a memory leak of pneg_inbuf. Fix this by returning via the out_free_inbuf exit path that will perform the relevant kfree. Addresses-Coverity: ("Resource leak") Fixes: 969ae8e8d4ee ("cifs: Accept validate negotiate if server return NT_STATUS_NOT_SUPPORTED") CC: Stable <stable@vger.kernel.org> # v5.1+ Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/smb2pdu.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 33afb637e6f8..c181f1621e1a 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -887,7 +887,8 @@ int smb3_validate_negotiate(const unsigned int xid, struct cifs_tcon *tcon)
* not supported error. Client should accept it.
*/
cifs_dbg(VFS, "Server does not support validate negotiate\n");
- return 0;
+ rc = 0;
+ goto out_free_inbuf;
} else if (rc != 0) {
cifs_dbg(VFS, "validate protocol negotiate failed: %d\n", rc);
rc = -EIO;