]> git.dujemihanovic.xyz Git - linux.git/commitdiff
cifs: Fix signature miscalculation
authorDavid Howells <dhowells@redhat.com>
Thu, 12 Sep 2024 15:58:48 +0000 (16:58 +0100)
committerSteve French <stfrench@microsoft.com>
Fri, 13 Sep 2024 00:28:48 +0000 (19:28 -0500)
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 <dhowells@redhat.com>
Reviewed-by: Tom Talpey <tom@talpey.com>
Reviewed-by: Paulo Alcantara (Red Hat) <pc@manguebit.com>
cc: Shyam Prasad N <nspmangalore@gmail.com>
cc: Rohith Surabattula <rohiths.msft@gmail.com>
cc: Jeff Layton <jlayton@kernel.org>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/cifsencrypt.c

index 6322f0f68a176b177c943b074fe414c4905bf9bb..b0473c2567fe687c218f2a0d92e202acc3b1234a 100644 (file)
@@ -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;