[PATCH 1/2] CIFS: Fix memory leak in SMB2 oplock break code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



SendReceive2 doesn't free a response buffer but SendReceiveNoRsp does.

Signed-off-by: Pavel Shilovsky <pshilovsky@xxxxxxxxx>
---
 fs/cifs/smb2pdu.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index b183420..88ac69c 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -1943,9 +1943,8 @@ SMB2_oplock_break(const unsigned int xid, struct cifs_tcon *tcon,
 		  const u64 persistent_fid, const u64 volatile_fid,
 		  __u8 oplock_level)
 {
-	int rc = 0, buf_type;
+	int rc;
 	struct smb2_oplock_break *req = NULL;
-	struct kvec iov[1];
 
 	cFYI(1, "SMB2_oplock_break");
 	rc = small_smb2_init(SMB2_OPLOCK_BREAK, tcon, (void **) &req);
@@ -1958,11 +1957,7 @@ SMB2_oplock_break(const unsigned int xid, struct cifs_tcon *tcon,
 	req->OplockLevel = oplock_level;
 	req->hdr.CreditRequest = cpu_to_le16(1);
 
-	iov->iov_base = (char *)req;
-	/* 4 for rfc1002 length */
-	iov->iov_len = get_rfc1002_length(req) + 4;
-
-	rc = SendReceive2(xid, tcon->ses, iov, 1, &buf_type, CIFS_OBREAK_OP);
+	rc = SendReceiveNoRsp(xid, tcon->ses, (char *) req, CIFS_OBREAK_OP);
 	/* SMB2 buffer freed by function above */
 
 	if (rc) {
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux