Skip to contentSkip to conversation

net/rds: rds_sendmsg should not discard payload_len

PATCH Superseded Allison Henderson 4 participants 4 messages Feb 10 – Feb 13

Subsystems (5)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Allison Henderson

author maintainer
#0 lore raw

PATCH v2 1/1 net/rds: rds_sendmsg should not discard payload_len

Commit 3db6e0d172c9 ("rds: use RCU to synchronize work-enqueue with connection teardown") modifies rds_sendmsg to avoid enqueueing work while a tear down is in progress. However, it also changed the return value of rds_sendmsg to that of rds_send_xmit instead of the payload_len. This means the user may incorrectly receive errno values when it should have simply received a payload of 0 while the peer attempts a reconnections. So this patch corrects the teardown handling code to only use the out error path in that case, thus restoring the original payload_len return value.

Fixes 3db6e0d172c9 ("rds: use RCU to synchronize work-enqueue with connection teardown")

---
Changes in v2:
- Rebased on net/main to fix apply failure in v1

---
 net/rds/send.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
net/rds/send.c +4 -2
index 0b3d0ef2f008..071c5dca969a 100644
@@ -1382,9 +1382,11 @@ int rds_sendmsg(struct socket *sock, struct msghdr *msg, size_t payload_len)
 		else
 			queue_delayed_work(rds_wq, &cpath->cp_send_w, 1);
 		rcu_read_unlock();
+
+		if (ret)
+			goto out;
 	}
-	if (ret)
-		goto out;
+
 	rds_message_put(rm);
 
 	for (ind = 0; ind < vct.indx; ind++)
Signature · 1 line
2.43.0
reviewer Reviewed-by on v2 1/1
#1 lore raw
Quoted 10 lines · Allison Henderson

Commit 3db6e0d172c9 ("rds: use RCU to synchronize work-enqueue with connection teardown") modifies rds_sendmsg to avoid enqueueing work while a tear down is in progress. However, it also changed the return value of rds_sendmsg to that of rds_send_xmit instead of the payload_len. This means the user may incorrectly receive errno values when it should have simply received a payload of 0 while the peer attempts a reconnections. So this patch corrects the teardown handling code to only use the out error path in that case, thus restoring the original payload_len return value.

Quoted 6 lines
Fixes 3db6e0d172c9 ("rds: use RCU to synchronize work-enqueue with connection teardown")

---
Changes in v2:
- Rebased on net/main to fix apply failure in v1

maintainer
#2 lore raw
In reply to Allison Henderson
Quoted 9 lines · On Tue, 10 Feb 2026 10:09:52 -0700 Allison Henderson wrote:

Commit 3db6e0d172c9 ("rds: use RCU to synchronize work-enqueue with connection teardown") modifies rds_sendmsg to avoid enqueueing work while a tear down is in progress. However, it also changed the return value of rds_sendmsg to that of rds_send_xmit instead of the payload_len. This means the user may incorrectly receive errno values when it should have simply received a payload of 0 while the peer attempts a reconnections. So this patch corrects the teardown handling code to only use the out error path in that case, thus restoring the original payload_len return value.

net-next now became net so this no longer applies. Please rebase?

Signature · 1 line
pw-bot: cr
#3 lore raw
Quoted 11 lines · Jakub Kicinski
Quoted 9 lines · On Tue, 10 Feb 2026 10:09:52 -0700 Allison Henderson wrote:

Commit 3db6e0d172c9 ("rds: use RCU to synchronize work-enqueue with connection teardown") modifies rds_sendmsg to avoid enqueueing work while a tear down is in progress. However, it also changed the return value of rds_sendmsg to that of rds_send_xmit instead of the payload_len. This means the user may incorrectly receive errno values when it should have simply received a payload of 0 while the peer attempts a reconnections. So this patch corrects the teardown handling code to only use the out error path in that case, thus restoring the original payload_len return value.

Quoted 2 lines

net-next now became net so this no longer applies. Please rebase?

Sure, I've sent a rebased v3.

Thank you
Allison