diff options
author | Pavel Shilovsky <pshilov@microsoft.com> | 2019-01-18 18:38:11 -0500 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2019-01-24 15:52:05 -0500 |
commit | ec678eae746dd25766a61c4095e2b649d3b20b09 (patch) | |
tree | 060d7ec05e67b14b327dcf61a32b83c579cb74df | |
parent | 8004c78c68e894e4fd5ac3c22cc22eb7dc24cabc (diff) |
CIFS: Fix credit calculation for encrypted reads with errors
We do need to account for credits received in error responses
to read requests on encrypted sessions.
Cc: <stable@vger.kernel.org>
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
-rw-r--r-- | fs/cifs/smb2ops.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index fa8d2e1076c8..73f9c6af4065 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c | |||
@@ -3207,11 +3207,23 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid, | |||
3207 | server->ops->is_status_pending(buf, server, 0)) | 3207 | server->ops->is_status_pending(buf, server, 0)) |
3208 | return -1; | 3208 | return -1; |
3209 | 3209 | ||
3210 | rdata->result = server->ops->map_error(buf, false); | 3210 | /* set up first two iov to get credits */ |
3211 | rdata->iov[0].iov_base = buf; | ||
3212 | rdata->iov[0].iov_len = 4; | ||
3213 | rdata->iov[1].iov_base = buf + 4; | ||
3214 | rdata->iov[1].iov_len = | ||
3215 | min_t(unsigned int, buf_len, server->vals->read_rsp_size) - 4; | ||
3216 | cifs_dbg(FYI, "0: iov_base=%p iov_len=%zu\n", | ||
3217 | rdata->iov[0].iov_base, rdata->iov[0].iov_len); | ||
3218 | cifs_dbg(FYI, "1: iov_base=%p iov_len=%zu\n", | ||
3219 | rdata->iov[1].iov_base, rdata->iov[1].iov_len); | ||
3220 | |||
3221 | rdata->result = server->ops->map_error(buf, true); | ||
3211 | if (rdata->result != 0) { | 3222 | if (rdata->result != 0) { |
3212 | cifs_dbg(FYI, "%s: server returned error %d\n", | 3223 | cifs_dbg(FYI, "%s: server returned error %d\n", |
3213 | __func__, rdata->result); | 3224 | __func__, rdata->result); |
3214 | dequeue_mid(mid, rdata->result); | 3225 | /* normal error on read response */ |
3226 | dequeue_mid(mid, false); | ||
3215 | return 0; | 3227 | return 0; |
3216 | } | 3228 | } |
3217 | 3229 | ||
@@ -3284,14 +3296,6 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid, | |||
3284 | return 0; | 3296 | return 0; |
3285 | } | 3297 | } |
3286 | 3298 | ||
3287 | /* set up first iov for signature check */ | ||
3288 | rdata->iov[0].iov_base = buf; | ||
3289 | rdata->iov[0].iov_len = 4; | ||
3290 | rdata->iov[1].iov_base = buf + 4; | ||
3291 | rdata->iov[1].iov_len = server->vals->read_rsp_size - 4; | ||
3292 | cifs_dbg(FYI, "0: iov_base=%p iov_len=%zu\n", | ||
3293 | rdata->iov[0].iov_base, server->vals->read_rsp_size); | ||
3294 | |||
3295 | length = rdata->copy_into_pages(server, rdata, &iter); | 3299 | length = rdata->copy_into_pages(server, rdata, &iter); |
3296 | 3300 | ||
3297 | kfree(bvec); | 3301 | kfree(bvec); |