Commit 0d81fcdd1447a0d3de5e4126be10734bce3c3468

Authored by Pavel Shilovsky
Committed by Greg Kroah-Hartman
1 parent 0ea9bb58b2

CIFS: Fix memory leaks in SMB2_open

commit 663a962151593c69374776e8651238d0da072459 upstream.

Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org>
Reviewed-by: Shirish Pargaonkar <spargaonkar@suse.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 1 changed file with 6 additions and 1 deletions Side-by-side Diff

... ... @@ -1089,6 +1089,7 @@
1089 1089 int rc = 0;
1090 1090 unsigned int num_iovecs = 2;
1091 1091 __u32 file_attributes = 0;
  1092 + char *dhc_buf = NULL, *lc_buf = NULL;
1092 1093  
1093 1094 cifs_dbg(FYI, "create/open\n");
1094 1095  
... ... @@ -1155,6 +1156,7 @@
1155 1156 kfree(copy_path);
1156 1157 return rc;
1157 1158 }
  1159 + lc_buf = iov[num_iovecs-1].iov_base;
1158 1160 }
1159 1161  
1160 1162 if (*oplock == SMB2_OPLOCK_LEVEL_BATCH) {
1161 1163  
... ... @@ -1169,9 +1171,10 @@
1169 1171 if (rc) {
1170 1172 cifs_small_buf_release(req);
1171 1173 kfree(copy_path);
1172   - kfree(iov[num_iovecs-1].iov_base);
  1174 + kfree(lc_buf);
1173 1175 return rc;
1174 1176 }
  1177 + dhc_buf = iov[num_iovecs-1].iov_base;
1175 1178 }
1176 1179  
1177 1180 rc = SendReceive2(xid, ses, iov, num_iovecs, &resp_buftype, 0);
... ... @@ -1203,6 +1206,8 @@
1203 1206 *oplock = rsp->OplockLevel;
1204 1207 creat_exit:
1205 1208 kfree(copy_path);
  1209 + kfree(lc_buf);
  1210 + kfree(dhc_buf);
1206 1211 free_rsp_buf(resp_buftype, rsp);
1207 1212 return rc;
1208 1213 }