mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] smbdirect: Fix error cleanup in smbdirect_map_sges_from_iter()
@ 2026-05-13 18:50 David Howells
  2026-05-14 11:02 ` Stefan Metzmacher
  0 siblings, 1 reply; 2+ messages in thread
From: David Howells @ 2026-05-13 18:50 UTC (permalink / raw)
  To: Steve French, Stefan Metzmacher
  Cc: dhowells, Paulo Alcantara, Tom Talpey, linux-cifs, linux-fsdevel,
	linux-kernel

Fix smbdirect_map_sges_from_iter() to use pre-decrement, not post-decrement
so that it cleans up the correct slots.

Fixes: e5fbdde43017 ("cifs: Add a function to build an RDMA SGE list from an iterator")
Closes: https://sashiko.dev/#/patchset/20260326104544.509518-1-dhowells%40redhat.com
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Stefan Metzmacher <metze@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Tom Talpey <tom@talpey.com>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
---
 fs/smb/smbdirect/connection.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/smb/smbdirect/connection.c b/fs/smb/smbdirect/connection.c
index fe9912e53da6..8adf58097534 100644
--- a/fs/smb/smbdirect/connection.c
+++ b/fs/smb/smbdirect/connection.c
@@ -2168,7 +2168,7 @@ static ssize_t smbdirect_map_sges_from_iter(struct iov_iter *iter, size_t len,
 
 	if (ret < 0) {
 		while (state->num_sge > before) {
-			struct ib_sge *sge = &state->sge[state->num_sge--];
+			struct ib_sge *sge = &state->sge[--state->num_sge];
 
 			ib_dma_unmap_page(state->device,
 					  sge->addr,


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

* Re: [PATCH] smbdirect: Fix error cleanup in smbdirect_map_sges_from_iter()
  2026-05-13 18:50 [PATCH] smbdirect: Fix error cleanup in smbdirect_map_sges_from_iter() David Howells
@ 2026-05-14 11:02 ` Stefan Metzmacher
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Metzmacher @ 2026-05-14 11:02 UTC (permalink / raw)
  To: David Howells, Steve French
  Cc: Paulo Alcantara, Tom Talpey, linux-cifs, linux-fsdevel, linux-kernel

Am 13.05.26 um 20:50 schrieb David Howells:
> Fix smbdirect_map_sges_from_iter() to use pre-decrement, not post-decrement
> so that it cleans up the correct slots.
> 
> Fixes: e5fbdde43017 ("cifs: Add a function to build an RDMA SGE list from an iterator")
> Closes: https://sashiko.dev/#/patchset/20260326104544.509518-1-dhowells%40redhat.com
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Steve French <sfrench@samba.org>
> cc: Stefan Metzmacher <metze@samba.org>
> cc: Paulo Alcantara <pc@manguebit.org>
> cc: Tom Talpey <tom@talpey.com>
> cc: linux-cifs@vger.kernel.org
> cc: linux-fsdevel@vger.kernel.org

Reviewed-by: Stefan Metzmacher <metze@samba.org>

Thanks!
metze

> ---
>   fs/smb/smbdirect/connection.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/smb/smbdirect/connection.c b/fs/smb/smbdirect/connection.c
> index fe9912e53da6..8adf58097534 100644
> --- a/fs/smb/smbdirect/connection.c
> +++ b/fs/smb/smbdirect/connection.c
> @@ -2168,7 +2168,7 @@ static ssize_t smbdirect_map_sges_from_iter(struct iov_iter *iter, size_t len,
>   
>   	if (ret < 0) {
>   		while (state->num_sge > before) {
> -			struct ib_sge *sge = &state->sge[state->num_sge--];
> +			struct ib_sge *sge = &state->sge[--state->num_sge];
>   
>   			ib_dma_unmap_page(state->device,
>   					  sge->addr,
> 


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

end of thread, other threads:[~2026-05-14 11:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-13 18:50 [PATCH] smbdirect: Fix error cleanup in smbdirect_map_sges_from_iter() David Howells
2026-05-14 11:02 ` Stefan Metzmacher

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®