Skip to contentSkip to conversation

net: rds: clear i_sends on setup unwind

PATCH Applied Ren Wei 3 participants 3 messages May 29 – Jun 2 1 message not in the archive

Subsystems (4)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Ren Wei

author
#1 lore raw

PATCH 1/1 net: rds: clear i_sends on setup unwind

From: Yuqi Xu <[email protected]>

The RDS IB connection teardown path is written so it can run during partial startup and on repeated shutdown attempts. It uses NULL pointers to distinguish resources that are still owned from resources that have already been released.

When rds_ib_setup_qp() fails after allocating i_sends but before allocating i_recvs, the sends_out path frees i_sends without clearing the pointer. A later shutdown pass can still treat that stale pointer as a live send ring allocation.

Clear i_sends after vfree() in the error unwind path so the existing shutdown logic continues to use the correct ownership state.

Fixes 3b12f73a5c29 ("rds: ib: add error handle")
Assisted-by Codex:GPT-5.4
---
 net/rds/ib_cm.c | 1 +
 1 file changed, 1 insertion(+)
net/rds/ib_cm.c +1 -0
index 0c64c504f79d..4001de0c4959 100644
@@ -656,6 +656,7 @@ static int rds_ib_setup_qp(struct rds_connection *conn)
 
 sends_out:
 	vfree(ic->i_sends);
+	ic->i_sends = NULL;
 
 ack_dma_out:
 	rds_dma_hdr_free(rds_ibdev->dev, ic->i_ack, ic->i_ack_dma,
Signature · 1 line
2.54.0
maintainer Reviewed-by on v1 1/1
#2 lore raw
Quoted 15 lines · Ren Wei

From: Yuqi Xu <[email protected]>

The RDS IB connection teardown path is written so it can run during partial startup and on repeated shutdown attempts. It uses NULL pointers to distinguish resources that are still owned from resources that have already been released.

When rds_ib_setup_qp() fails after allocating i_sends but before allocating i_recvs, the sends_out path frees i_sends without clearing the pointer. A later shutdown pass can still treat that stale pointer as a live send ring allocation.

Clear i_sends after vfree() in the error unwind path so the existing shutdown logic continues to use the correct ownership state.

Quoted 8 lines
Fixes 3b12f73a5c29 ("rds: ib: add error handle")
Assisted-by Codex:GPT-5.4

Hi Ren Wei,

Looks fine to me. Thanks for the catch!

Allison

Quoted 16 lines
---
 net/rds/ib_cm.c | 1 +
 1 file changed, 1 insertion(+)
net/rds/ib_cm.c +1 -0
index 0c64c504f79d..4001de0c4959 100644
@@ -656,6 +656,7 @@ static int rds_ib_setup_qp(struct rds_connection *conn)
 
 sends_out:
 	vfree(ic->i_sends);
+	ic->i_sends = NULL;
 
 ack_dma_out:
 	rds_dma_hdr_free(rds_ibdev->dev, ic->i_ack, ic->i_ack_dma,
#3 lore raw
In reply to Ren Wei
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Fri, 29 May 2026 21:01:44 +0800 you wrote:

From: Yuqi Xu <[email protected]>

The RDS IB connection teardown path is written so it can run during partial startup and on repeated shutdown attempts. It uses NULL pointers to distinguish resources that are still owned from resources that have already been released.

[...]

Here is the summary with links:
- [net,1/1] net: rds: clear i_sends on setup unwind

    https://git.kernel.org/netdev/net/c/20cf0fb715c4

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html