Netdev List
 help / color / mirror / Atom feed
* [PATCH net v1] net/rds: reset op_nents when zerocopy page pin fails
@ 2026-05-05 23:43 Allison Henderson
  2026-05-09 10:59 ` Simon Horman
  2026-05-12  0:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Allison Henderson @ 2026-05-05 23:43 UTC (permalink / raw)
  To: netdev, pabeni, edumazet, kuba, horms, linux-rdma, achender

When iov_iter_get_pages2() fails in rds_message_zcopy_from_user(),
the pinned pages are released with put_page(), and
rm->data.op_mmp_znotifier is cleared.  But we fail to properly
clear rm->data.op_nents.

Later when rds_message_purge() is called from rds_sendmsg() the
cleanup loop iterates over the incorrectly non zero number of
op_nents and frees them again.

Fix this by properly resetting op_nents when it should be in
rds_message_zcopy_from_user().

Fixes: 0cebaccef3ac ("rds: zerocopy Tx support.")
Signed-off-by: Allison Henderson <achender@kernel.org>
---
 net/rds/message.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/rds/message.c b/net/rds/message.c
index 25fedcb3cd00..7feb0eb6537d 100644
--- a/net/rds/message.c
+++ b/net/rds/message.c
@@ -448,6 +448,7 @@ static int rds_message_zcopy_from_user(struct rds_message *rm, struct iov_iter *
 
 			for (i = 0; i < rm->data.op_nents; i++)
 				put_page(sg_page(&rm->data.op_sg[i]));
+			rm->data.op_nents = 0;
 			mmp = &rm->data.op_mmp_znotifier->z_mmp;
 			mm_unaccount_pinned_pages(mmp);
 			ret = -EFAULT;
-- 
2.43.0


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

* Re: [PATCH net v1] net/rds: reset op_nents when zerocopy page pin fails
  2026-05-05 23:43 [PATCH net v1] net/rds: reset op_nents when zerocopy page pin fails Allison Henderson
@ 2026-05-09 10:59 ` Simon Horman
  2026-05-12  0:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2026-05-09 10:59 UTC (permalink / raw)
  To: Allison Henderson; +Cc: netdev, pabeni, edumazet, kuba, linux-rdma

On Tue, May 05, 2026 at 04:43:36PM -0700, Allison Henderson wrote:
> When iov_iter_get_pages2() fails in rds_message_zcopy_from_user(),
> the pinned pages are released with put_page(), and
> rm->data.op_mmp_znotifier is cleared.  But we fail to properly
> clear rm->data.op_nents.
> 
> Later when rds_message_purge() is called from rds_sendmsg() the
> cleanup loop iterates over the incorrectly non zero number of
> op_nents and frees them again.
> 
> Fix this by properly resetting op_nents when it should be in
> rds_message_zcopy_from_user().
> 
> Fixes: 0cebaccef3ac ("rds: zerocopy Tx support.")
> Signed-off-by: Allison Henderson <achender@kernel.org>

Reviewed-by: Simon Horman <horms@kernel.org>


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

* Re: [PATCH net v1] net/rds: reset op_nents when zerocopy page pin fails
  2026-05-05 23:43 [PATCH net v1] net/rds: reset op_nents when zerocopy page pin fails Allison Henderson
  2026-05-09 10:59 ` Simon Horman
@ 2026-05-12  0:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-05-12  0:30 UTC (permalink / raw)
  To: Allison Henderson; +Cc: netdev, pabeni, edumazet, kuba, horms, linux-rdma

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue,  5 May 2026 16:43:36 -0700 you wrote:
> When iov_iter_get_pages2() fails in rds_message_zcopy_from_user(),
> the pinned pages are released with put_page(), and
> rm->data.op_mmp_znotifier is cleared.  But we fail to properly
> clear rm->data.op_nents.
> 
> Later when rds_message_purge() is called from rds_sendmsg() the
> cleanup loop iterates over the incorrectly non zero number of
> op_nents and frees them again.
> 
> [...]

Here is the summary with links:
  - [net,v1] net/rds: reset op_nents when zerocopy page pin fails
    https://git.kernel.org/netdev/net/c/e17492979319

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2026-05-12  0:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-05 23:43 [PATCH net v1] net/rds: reset op_nents when zerocopy page pin fails Allison Henderson
2026-05-09 10:59 ` Simon Horman
2026-05-12  0:30 ` patchwork-bot+netdevbpf

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