Skip to content

Commit 30b2b21

Browse files
ematsumiyasmfrench
authored andcommitted
cifs: do not include page data when checking signature
On async reads, page data is allocated before sending. When the response is received but it has no data to fill (e.g. STATUS_END_OF_FILE), __calc_signature() will still include the pages in its computation, leading to an invalid signature check. This patch fixes this by not setting the async read smb_rqst page data (zeroed by default) if its got_bytes is 0. This can be reproduced/verified with xfstests generic/465. Cc: <[email protected]> Signed-off-by: Enzo Matsumiya <[email protected]> Reviewed-by: Paulo Alcantara (SUSE) <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent d6a49e8 commit 30b2b21

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

fs/cifs/smb2pdu.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4163,12 +4163,15 @@ smb2_readv_callback(struct mid_q_entry *mid)
41634163
(struct smb2_hdr *)rdata->iov[0].iov_base;
41644164
struct cifs_credits credits = { .value = 0, .instance = 0 };
41654165
struct smb_rqst rqst = { .rq_iov = &rdata->iov[1],
4166-
.rq_nvec = 1,
4167-
.rq_pages = rdata->pages,
4168-
.rq_offset = rdata->page_offset,
4169-
.rq_npages = rdata->nr_pages,
4170-
.rq_pagesz = rdata->pagesz,
4171-
.rq_tailsz = rdata->tailsz };
4166+
.rq_nvec = 1, };
4167+
4168+
if (rdata->got_bytes) {
4169+
rqst.rq_pages = rdata->pages;
4170+
rqst.rq_offset = rdata->page_offset;
4171+
rqst.rq_npages = rdata->nr_pages;
4172+
rqst.rq_pagesz = rdata->pagesz;
4173+
rqst.rq_tailsz = rdata->tailsz;
4174+
}
41724175

41734176
WARN_ONCE(rdata->server != mid->server,
41744177
"rdata server %p != mid server %p",

0 commit comments

Comments
 (0)