diff mbox series

cifs: fix memory leak in SMB2_read

Message ID 20190423063945.28996-1-lsahlber@redhat.com (mailing list archive)
State New, archived
Headers show
Series cifs: fix memory leak in SMB2_read | expand

Commit Message

Ronnie Sahlberg April 23, 2019, 6:39 a.m. UTC
Commit 088aaf17aa79300cab14dbee2569c58cfafd7d6e introduced a leak where
if SMB2_read() returned an error we would return without feeing the request
buffer.

Cc: Stable <stable@vger.kernel.org>
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
---
 fs/cifs/smb2pdu.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Pavel Shilovsky April 23, 2019, 5:50 p.m. UTC | #1
пн, 22 апр. 2019 г. в 23:40, Ronnie Sahlberg <lsahlber@redhat.com>:
>
> Commit 088aaf17aa79300cab14dbee2569c58cfafd7d6e introduced a leak where
> if SMB2_read() returned an error we would return without feeing the request
> buffer.
>
> Cc: Stable <stable@vger.kernel.org>
> Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
> ---
>  fs/cifs/smb2pdu.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
> index 463c9298cd67..a932dccafc5b 100644
> --- a/fs/cifs/smb2pdu.c
> +++ b/fs/cifs/smb2pdu.c
> @@ -3463,6 +3463,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,
> --
> 2.13.6
>

Looks good.

Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>

--
Best regards,
Pavel Shilovsky
diff mbox series

Patch

diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 463c9298cd67..a932dccafc5b 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -3463,6 +3463,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,