cifs: Fix signature miscalculation
Subsystems (3)
PATCH 1/1 cifs: Fix signature miscalculation
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 39bc58203f04 ("cifs: Add a function to Hash the contents of an iterator")
Signed-off-by David Howells <[email protected]>
cc Steve French <[email protected]>
cc Paulo Alcantara <[email protected]>
cc Shyam Prasad N <[email protected]>
cc Rohith Surabattula <[email protected]>
cc Jeff Layton <[email protected]>
--- fs/smb/client/cifsencrypt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/smb/client/cifsencrypt.c +1 -1
@@ -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;
looks like this fixes the problem - merged into cifs-2.6.git for-next
Quoted 33 lines · David Howells
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 39bc58203f04 ("cifs: Add a function to Hash the contents of an iterator")Signed-off-by David Howells <[email protected]>cc Steve French <[email protected]>cc Paulo Alcantara <[email protected]>cc Shyam Prasad N <[email protected]>cc Rohith Surabattula <[email protected]>cc Jeff Layton <[email protected]>--- fs/smb/client/cifsencrypt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/smb/client/cifsencrypt.c +1
-1@@ -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;
Signature · 3 lines
Thanks, Steve
Ouch! Thanks for this, and just in time for next week's IOLab. :)
Reviewed-by Tom Talpey <[email protected]>
Tom.
Quoted 38 lines · Steve French
looks like this fixes the problem - merged into cifs-2.6.git for-next
Quoted 33 lines · David Howells
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 39bc58203f04 ("cifs: Add a function to Hash the contents of an iterator")Signed-off-by David Howells <[email protected]>cc Steve French <[email protected]>cc Paulo Alcantara <[email protected]>cc Shyam Prasad N <[email protected]>cc Rohith Surabattula <[email protected]>cc Jeff Layton <[email protected]>--- fs/smb/client/cifsencrypt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/smb/client/cifsencrypt.c +1
-1@@ -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;