cifs: fix memory leak in SMB2_read [Linux 5.1]

cifs: fix memory leak in SMB2_read [Linux 5.1]

This Linux kernel change "cifs: fix memory leak in SMB2_read" is included in the Linux 5.1 release. This change is authored by Ronnie Sahlberg <lsahlber [at] redhat.com> on Tue Apr 23 16:39:45 2019 +1000. The commit for this change in Linux stable tree is 05fd5c2 (patch).

cifs: fix memory leak in SMB2_read

Commit 088aaf17aa79300cab14dbee2569c58cfafd7d6e introduced a leak where
if SMB2_read() returned an error we would return without freeing the
request buffer.

Cc: Stable <[email protected]>
Signed-off-by: Ronnie Sahlberg <[email protected]>
Reviewed-by: Pavel Shilovsky <[email protected]>
Signed-off-by: Steve French <[email protected]>

There is one line of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 fs/cifs/smb2pdu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index b8f7262..a37774a 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -3466,6 +3466,7 @@ void smb2_reconnect_server(struct work_struct *work)
                    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,

Leave a Reply

Your email address will not be published. Required fields are marked *