Skip to content

Commit

Permalink
CIFS: Fix memory leaks in SMB2_open
Browse files Browse the repository at this point in the history
Cc: <stable@vger.kernel.org> # v3.12+
Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org>
Reviewed-by: Shirish Pargaonkar <spargaonkar@suse.com>
Signed-off-by: Steve French <smfrench@gmail.com>
  • Loading branch information
Pavel Shilovsky authored and Steve French committed May 24, 2014
1 parent 08b37d5 commit 663a962
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion fs/cifs/smb2pdu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1097,6 +1097,7 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
int rc = 0;
unsigned int num_iovecs = 2;
__u32 file_attributes = 0;
char *dhc_buf = NULL, *lc_buf = NULL;

cifs_dbg(FYI, "create/open\n");

Expand Down Expand Up @@ -1163,6 +1164,7 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
kfree(copy_path);
return rc;
}
lc_buf = iov[num_iovecs-1].iov_base;
}

if (*oplock == SMB2_OPLOCK_LEVEL_BATCH) {
Expand All @@ -1177,9 +1179,10 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
if (rc) {
cifs_small_buf_release(req);
kfree(copy_path);
kfree(iov[num_iovecs-1].iov_base);
kfree(lc_buf);
return rc;
}
dhc_buf = iov[num_iovecs-1].iov_base;
}

rc = SendReceive2(xid, ses, iov, num_iovecs, &resp_buftype, 0);
Expand Down Expand Up @@ -1211,6 +1214,8 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
*oplock = rsp->OplockLevel;
creat_exit:
kfree(copy_path);
kfree(lc_buf);
kfree(dhc_buf);
free_rsp_buf(resp_buftype, rsp);
return rc;
}
Expand Down

0 comments on commit 663a962

Please sign in to comment.