Commit 602befe5 authored by David Howells's avatar David Howells Committed by Wen Zhiwei
Browse files

cifs: Fix signature miscalculation

stable inclusion
from stable-v6.6.52
commit b9d510e085040f1ba549f26e41eb7c7f6ba1cb8f
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IAYXOD

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=b9d510e085040f1ba549f26e41eb7c7f6ba1cb8f



--------------------------------

[ Upstream commit 5a20b7cb0d8d3ee490a8e088dc2584aa782e3355 ]

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: 39bc5820 ("cifs: Add a function to Hash the contents of an iterator")
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Reviewed-by: default avatarTom Talpey <tom@talpey.com>
Reviewed-by: default avatarPaulo 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: default avatarSteve French <stfrench@microsoft.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarWen Zhiwei <wenzhiwei@kylinos.cn>
parent dbd3be51
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;