mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] cifs: Fix signature miscalculation
@ 2024-09-12 15:58 David Howells
  2024-09-12 16:24 ` Steve French
  0 siblings, 1 reply; 3+ messages in thread
From: David Howells @ 2024-09-12 15:58 UTC (permalink / raw)
  To: Steve French
  Cc: dhowells, Paulo Alcantara, Shyam Prasad N, Rohith Surabattula,
	Jeff Layton, linux-cifs, linux-fsdevel, linux-kernel

    
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>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <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
---
 fs/smb/client/cifsencrypt.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/smb/client/cifsencrypt.c b/fs/smb/client/cifsencrypt.c
index 6322f0f68a17..b0473c2567fe 100644
--- a/fs/smb/client/cifsencrypt.c
+++ b/fs/smb/client/cifsencrypt.c
@@ -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;


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cifs: Fix signature miscalculation
  2024-09-12 15:58 [PATCH] cifs: Fix signature miscalculation David Howells
@ 2024-09-12 16:24 ` Steve French
  2024-09-12 19:49   ` Tom Talpey
  0 siblings, 1 reply; 3+ messages in thread
From: Steve French @ 2024-09-12 16:24 UTC (permalink / raw)
  To: David Howells
  Cc: Steve French, Paulo Alcantara, Shyam Prasad N,
	Rohith Surabattula, Jeff Layton, linux-cifs, linux-fsdevel,
	linux-kernel

looks like this fixes the problem - merged into cifs-2.6.git for-next

On Thu, Sep 12, 2024 at 10:59 AM David Howells <dhowells@redhat.com> wrote:
>
>
> 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>
> cc: Steve French <sfrench@samba.org>
> cc: Paulo Alcantara <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
> ---
>  fs/smb/client/cifsencrypt.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/smb/client/cifsencrypt.c b/fs/smb/client/cifsencrypt.c
> index 6322f0f68a17..b0473c2567fe 100644
> --- a/fs/smb/client/cifsencrypt.c
> +++ b/fs/smb/client/cifsencrypt.c
> @@ -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;
>
>


-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cifs: Fix signature miscalculation
  2024-09-12 16:24 ` Steve French
@ 2024-09-12 19:49   ` Tom Talpey
  0 siblings, 0 replies; 3+ messages in thread
From: Tom Talpey @ 2024-09-12 19:49 UTC (permalink / raw)
  To: Steve French, David Howells
  Cc: Steve French, Paulo Alcantara, Shyam Prasad N,
	Rohith Surabattula, Jeff Layton, linux-cifs, linux-fsdevel,
	linux-kernel

Ouch! Thanks for this, and just in time for next week's IOLab. :)

Reviewed-by: Tom Talpey <tom@talpey.com>

Tom.

On 9/12/2024 12:24 PM, Steve French wrote:
> looks like this fixes the problem - merged into cifs-2.6.git for-next
> 
> On Thu, Sep 12, 2024 at 10:59 AM David Howells <dhowells@redhat.com> wrote:
>>
>>
>> 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>
>> cc: Steve French <sfrench@samba.org>
>> cc: Paulo Alcantara <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
>> ---
>>   fs/smb/client/cifsencrypt.c |    2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/smb/client/cifsencrypt.c b/fs/smb/client/cifsencrypt.c
>> index 6322f0f68a17..b0473c2567fe 100644
>> --- a/fs/smb/client/cifsencrypt.c
>> +++ b/fs/smb/client/cifsencrypt.c
>> @@ -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;
>>
>>
> 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-09-12 19:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-12 15:58 [PATCH] cifs: Fix signature miscalculation David Howells
2024-09-12 16:24 ` Steve French
2024-09-12 19:49   ` Tom Talpey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®