aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Shilovsky <pshilovsky@samba.org>2014-05-24 08:42:02 -0400
committerSteve French <smfrench@gmail.com>2014-05-24 16:24:20 -0400
commit663a962151593c69374776e8651238d0da072459 (patch)
tree6f2a60475f96a8acee862cb15c760eac3e40a8df
parent08b37d518af365e7a52fe11320ea683856407581 (diff)
CIFS: Fix memory leaks in SMB2_open
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>
-rw-r--r--fs/cifs/smb2pdu.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index b0037b609c54..b0b260dbb19d 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -1097,6 +1097,7 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
1097 int rc = 0; 1097 int rc = 0;
1098 unsigned int num_iovecs = 2; 1098 unsigned int num_iovecs = 2;
1099 __u32 file_attributes = 0; 1099 __u32 file_attributes = 0;
1100 char *dhc_buf = NULL, *lc_buf = NULL;
1100 1101
1101 cifs_dbg(FYI, "create/open\n"); 1102 cifs_dbg(FYI, "create/open\n");
1102 1103
@@ -1163,6 +1164,7 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
1163 kfree(copy_path); 1164 kfree(copy_path);
1164 return rc; 1165 return rc;
1165 } 1166 }
1167 lc_buf = iov[num_iovecs-1].iov_base;
1166 } 1168 }
1167 1169
1168 if (*oplock == SMB2_OPLOCK_LEVEL_BATCH) { 1170 if (*oplock == SMB2_OPLOCK_LEVEL_BATCH) {
@@ -1177,9 +1179,10 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
1177 if (rc) { 1179 if (rc) {
1178 cifs_small_buf_release(req); 1180 cifs_small_buf_release(req);
1179 kfree(copy_path); 1181 kfree(copy_path);
1180 kfree(iov[num_iovecs-1].iov_base); 1182 kfree(lc_buf);
1181 return rc; 1183 return rc;
1182 } 1184 }
1185 dhc_buf = iov[num_iovecs-1].iov_base;
1183 } 1186 }
1184 1187
1185 rc = SendReceive2(xid, ses, iov, num_iovecs, &resp_buftype, 0); 1188 rc = SendReceive2(xid, ses, iov, num_iovecs, &resp_buftype, 0);
@@ -1211,6 +1214,8 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
1211 *oplock = rsp->OplockLevel; 1214 *oplock = rsp->OplockLevel;
1212creat_exit: 1215creat_exit:
1213 kfree(copy_path); 1216 kfree(copy_path);
1217 kfree(lc_buf);
1218 kfree(dhc_buf);
1214 free_rsp_buf(resp_buftype, rsp); 1219 free_rsp_buf(resp_buftype, rsp);
1215 return rc; 1220 return rc;
1216} 1221}