Skip to content

Commit e1c72cb

Browse files
author
Ronnie Sahlberg
committed
cifs: do not include page data when checking signature
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2218388 commit 30b2b21 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: <stable@vger.kernel.org> Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de> Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz> Signed-off-by: Steve French <stfrench@microsoft.com> (cherry picked from commit 30b2b21) Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
1 parent 7aebdda commit e1c72cb

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)