Skip to content

Commit

Permalink
cifs: Fix signature miscalculation
Browse files Browse the repository at this point in the history
[ Upstream commit 5a20b7c ]

Fix the calculation of packet signatures by adding the offset into a page
in the read or write data payload when hashing the pages from it.

Fixes: 39bc582 ("cifs: Add a function to Hash the contents of an iterator")
Signed-off-by: David Howells <[email protected]>
Reviewed-by: Tom Talpey <[email protected]>
Reviewed-by: Paulo Alcantara (Red Hat) <[email protected]>
cc: Shyam Prasad N <[email protected]>
cc: Rohith Surabattula <[email protected]>
cc: Jeff Layton <[email protected]>
cc: [email protected]
cc: [email protected]
Signed-off-by: Steve French <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
dhowells authored and gregkh committed Sep 18, 2024
1 parent 7f7417d commit 6c69458
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/smb/client/cifsencrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ static ssize_t cifs_shash_xarray(const struct iov_iter *iter, ssize_t maxsize,
for (j = foffset / PAGE_SIZE; j < npages; j++) {
len = min_t(size_t, maxsize, PAGE_SIZE - offset);
p = kmap_local_page(folio_page(folio, j));
ret = crypto_shash_update(shash, p, len);
ret = crypto_shash_update(shash, p + offset, len);
kunmap_local(p);
if (ret < 0)
return ret;
Expand Down

0 comments on commit 6c69458

Please sign in to comment.