cifs: fix memory leak in SMB2_read
authorRonnie Sahlberg <lsahlber@redhat.com>
Tue, 23 Apr 2019 06:39:45 +0000 (16:39 +1000)
committerSteve French <stfrench@microsoft.com>
Wed, 24 Apr 2019 17:33:59 +0000 (12:33 -0500)
Commit 088aaf17aa79300cab14dbee2569c58cfafd7d6e introduced a leak where
if SMB2_read() returned an error we would return without freeing the
request buffer.

Cc: Stable <stable@vger.kernel.org>
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/smb2pdu.c

index b8f7262ac35412f3d1f13743ba4555f8756018b5..a37774a55f3aa1b8598ebd30b063fff67d4cb32f 100644 (file)
@@ -3466,6 +3466,7 @@ SMB2_read(const unsigned int xid, struct cifs_io_parms *io_parms,
                                    io_parms->tcon->tid, ses->Suid,
                                    io_parms->offset, 0);
                free_rsp_buf(resp_buftype, rsp_iov.iov_base);
+               cifs_small_buf_release(req);
                return rc == -ENODATA ? 0 : rc;
        } else
                trace_smb3_read_done(xid, req->PersistentFileId,