| From 914237df64c59caae6d51a8335374bf544ffd1d9 Mon Sep 17 00:00:00 2001 |
| From: Ronnie Sahlberg <lsahlber@redhat.com> |
| Date: Wed, 8 Jan 2020 13:08:07 +1000 |
| Subject: [PATCH] cifs: set correct max-buffer-size for smb2_ioctl_init() |
| |
| commit 731b82bb1750a906c1e7f070aedf5505995ebea7 upstream. |
| |
| Fix two places where we need to adjust down the max response size for |
| ioctl when it is used together with compounding. |
| |
| Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> |
| Signed-off-by: Steve French <stfrench@microsoft.com> |
| Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com> |
| CC: Stable <stable@vger.kernel.org> |
| Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c |
| index 24a7618470ec..20360dc77f24 100644 |
| --- a/fs/cifs/smb2ops.c |
| +++ b/fs/cifs/smb2ops.c |
| @@ -1449,7 +1449,9 @@ smb2_ioctl_query_info(const unsigned int xid, |
| COMPOUND_FID, COMPOUND_FID, |
| qi.info_type, true, buffer, |
| qi.output_buffer_length, |
| - CIFSMaxBufSize); |
| + CIFSMaxBufSize - |
| + MAX_SMB2_CREATE_RESPONSE_SIZE - |
| + MAX_SMB2_CLOSE_RESPONSE_SIZE); |
| } |
| } else if (qi.flags == PASSTHRU_QUERY_INFO) { |
| memset(&qi_iov, 0, sizeof(qi_iov)); |
| @@ -2540,7 +2542,10 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon, |
| |
| rc = SMB2_ioctl_init(tcon, &rqst[1], fid.persistent_fid, |
| fid.volatile_fid, FSCTL_GET_REPARSE_POINT, |
| - true /* is_fctl */, NULL, 0, CIFSMaxBufSize); |
| + true /* is_fctl */, NULL, 0, |
| + CIFSMaxBufSize - |
| + MAX_SMB2_CREATE_RESPONSE_SIZE - |
| + MAX_SMB2_CLOSE_RESPONSE_SIZE); |
| if (rc) |
| goto querty_exit; |
| |
| -- |
| 2.7.4 |
| |