diff options
-rw-r--r-- | fs/cifs/cifsproto.h | 1 | ||||
-rw-r--r-- | fs/cifs/cifssmb.c | 20 | ||||
-rw-r--r-- | fs/cifs/misc.c | 9 | ||||
-rw-r--r-- | fs/cifs/smb2pdu.c | 10 |
4 files changed, 14 insertions, 26 deletions
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index ca7980a1e303..de49d7a37b00 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
@@ -36,6 +36,7 @@ extern struct smb_hdr *cifs_buf_get(void); | |||
36 | extern void cifs_buf_release(void *); | 36 | extern void cifs_buf_release(void *); |
37 | extern struct smb_hdr *cifs_small_buf_get(void); | 37 | extern struct smb_hdr *cifs_small_buf_get(void); |
38 | extern void cifs_small_buf_release(void *); | 38 | extern void cifs_small_buf_release(void *); |
39 | extern void free_rsp_buf(int, void *); | ||
39 | extern void cifs_rqst_page_to_kvec(struct smb_rqst *rqst, unsigned int idx, | 40 | extern void cifs_rqst_page_to_kvec(struct smb_rqst *rqst, unsigned int idx, |
40 | struct kvec *iov); | 41 | struct kvec *iov); |
41 | extern int smb_send(struct TCP_Server_Info *, struct smb_hdr *, | 42 | extern int smb_send(struct TCP_Server_Info *, struct smb_hdr *, |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 6ce4e0954b98..b7e5b6508caa 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -1734,10 +1734,7 @@ CIFSSMBRead(const unsigned int xid, struct cifs_io_parms *io_parms, | |||
1734 | 1734 | ||
1735 | /* cifs_small_buf_release(pSMB); */ /* Freed earlier now in SendReceive2 */ | 1735 | /* cifs_small_buf_release(pSMB); */ /* Freed earlier now in SendReceive2 */ |
1736 | if (*buf) { | 1736 | if (*buf) { |
1737 | if (resp_buf_type == CIFS_SMALL_BUFFER) | 1737 | free_rsp_buf(resp_buf_type, iov[0].iov_base); |
1738 | cifs_small_buf_release(iov[0].iov_base); | ||
1739 | else if (resp_buf_type == CIFS_LARGE_BUFFER) | ||
1740 | cifs_buf_release(iov[0].iov_base); | ||
1741 | } else if (resp_buf_type != CIFS_NO_BUFFER) { | 1738 | } else if (resp_buf_type != CIFS_NO_BUFFER) { |
1742 | /* return buffer to caller to free */ | 1739 | /* return buffer to caller to free */ |
1743 | *buf = iov[0].iov_base; | 1740 | *buf = iov[0].iov_base; |
@@ -2203,10 +2200,7 @@ CIFSSMBWrite2(const unsigned int xid, struct cifs_io_parms *io_parms, | |||
2203 | } | 2200 | } |
2204 | 2201 | ||
2205 | /* cifs_small_buf_release(pSMB); */ /* Freed earlier now in SendReceive2 */ | 2202 | /* cifs_small_buf_release(pSMB); */ /* Freed earlier now in SendReceive2 */ |
2206 | if (resp_buf_type == CIFS_SMALL_BUFFER) | 2203 | free_rsp_buf(resp_buf_type, iov[0].iov_base); |
2207 | cifs_small_buf_release(iov[0].iov_base); | ||
2208 | else if (resp_buf_type == CIFS_LARGE_BUFFER) | ||
2209 | cifs_buf_release(iov[0].iov_base); | ||
2210 | 2204 | ||
2211 | /* Note: On -EAGAIN error only caller can retry on handle based calls | 2205 | /* Note: On -EAGAIN error only caller can retry on handle based calls |
2212 | since file handle passed in no longer valid */ | 2206 | since file handle passed in no longer valid */ |
@@ -2451,10 +2445,7 @@ plk_err_exit: | |||
2451 | if (pSMB) | 2445 | if (pSMB) |
2452 | cifs_small_buf_release(pSMB); | 2446 | cifs_small_buf_release(pSMB); |
2453 | 2447 | ||
2454 | if (resp_buf_type == CIFS_SMALL_BUFFER) | 2448 | free_rsp_buf(resp_buf_type, iov[0].iov_base); |
2455 | cifs_small_buf_release(iov[0].iov_base); | ||
2456 | else if (resp_buf_type == CIFS_LARGE_BUFFER) | ||
2457 | cifs_buf_release(iov[0].iov_base); | ||
2458 | 2449 | ||
2459 | /* Note: On -EAGAIN error only caller can retry on handle based calls | 2450 | /* Note: On -EAGAIN error only caller can retry on handle based calls |
2460 | since file handle passed in no longer valid */ | 2451 | since file handle passed in no longer valid */ |
@@ -3838,10 +3829,7 @@ CIFSSMBGetCIFSACL(const unsigned int xid, struct cifs_tcon *tcon, __u16 fid, | |||
3838 | } | 3829 | } |
3839 | } | 3830 | } |
3840 | qsec_out: | 3831 | qsec_out: |
3841 | if (buf_type == CIFS_SMALL_BUFFER) | 3832 | free_rsp_buf(buf_type, iov[0].iov_base); |
3842 | cifs_small_buf_release(iov[0].iov_base); | ||
3843 | else if (buf_type == CIFS_LARGE_BUFFER) | ||
3844 | cifs_buf_release(iov[0].iov_base); | ||
3845 | /* cifs_small_buf_release(pSMB); */ /* Freed earlier now in SendReceive2 */ | 3833 | /* cifs_small_buf_release(pSMB); */ /* Freed earlier now in SendReceive2 */ |
3846 | return rc; | 3834 | return rc; |
3847 | } | 3835 | } |
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c index 3b0c62e622da..64997a04ab59 100644 --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c | |||
@@ -226,6 +226,15 @@ cifs_small_buf_release(void *buf_to_free) | |||
226 | return; | 226 | return; |
227 | } | 227 | } |
228 | 228 | ||
229 | void | ||
230 | free_rsp_buf(int resp_buftype, void *rsp) | ||
231 | { | ||
232 | if (resp_buftype == CIFS_SMALL_BUFFER) | ||
233 | cifs_small_buf_release(rsp); | ||
234 | else if (resp_buftype == CIFS_LARGE_BUFFER) | ||
235 | cifs_buf_release(rsp); | ||
236 | } | ||
237 | |||
229 | /* NB: MID can not be set if treeCon not passed in, in that | 238 | /* NB: MID can not be set if treeCon not passed in, in that |
230 | case it is responsbility of caller to set the mid */ | 239 | case it is responsbility of caller to set the mid */ |
231 | void | 240 | void |
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index b0b260dbb19d..0158104df745 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c | |||
@@ -309,16 +309,6 @@ small_smb2_init(__le16 smb2_command, struct cifs_tcon *tcon, | |||
309 | return rc; | 309 | return rc; |
310 | } | 310 | } |
311 | 311 | ||
312 | static void | ||
313 | free_rsp_buf(int resp_buftype, void *rsp) | ||
314 | { | ||
315 | if (resp_buftype == CIFS_SMALL_BUFFER) | ||
316 | cifs_small_buf_release(rsp); | ||
317 | else if (resp_buftype == CIFS_LARGE_BUFFER) | ||
318 | cifs_buf_release(rsp); | ||
319 | } | ||
320 | |||
321 | |||
322 | /* | 312 | /* |
323 | * | 313 | * |
324 | * SMB2 Worker functions follow: | 314 | * SMB2 Worker functions follow: |