From a364a7c168d0a0b9fccee01669ceb9bb7b844056 Mon Sep 17 00:00:00 2001 From: Sharath Srinivasan Date: Sat, 8 Aug 2026 17:51:02 -0700 Subject: [PATCH] net/rds: reinitialize to_be_dropped on rds_send_xmit() restart The to_be_dropped list is declared once at the top of rds_send_xmit() but the function can loop via "goto restart" after each batch. The code currently relies on rds_send_remove_from_sock() having emptied the list entry by entry (via list_del_init()) at the end of the previous batch; nothing in rds_send_xmit() itself guarantees the list head is empty when a new batch starts. Re-initialize the list on every restart, and warn once if it is ever found non-empty there: entries left on the list at that point would keep their message reference, their RDS_MSG_ON_SOCK accounting and their pending RDS_RDMA_DROPPED notification, so a silent re-init would orphan them. This is hardening: no user-visible bug is known in the current code. This mirrors Oracle UEK commit "net/rds: rds_send_xmit should INIT_LIST_HEAD(&to_be_dropped) on restart". Signed-off-by: Gerd Rausch Signed-off-by: Sharath Srinivasan [achender: port to net-next (keep the existing LIST_HEAD declaration and add only the restart re-init); warn if the restart invariant is violated; update commit message] Assisted-by: Claude-Code:claude-fable-5 Signed-off-by: Allison Henderson Link: https://patch.msgid.link/20260809005103.82371-2-achender@kernel.org Reviewed-by: Simon Horman Signed-off-by: Paolo Abeni --- net/rds/send.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/net/rds/send.c b/net/rds/send.c index 309021e0cc9b..15a1b97f13e7 100644 --- a/net/rds/send.c +++ b/net/rds/send.c @@ -200,6 +200,14 @@ int rds_send_xmit(struct rds_conn_path *cp) restart: batch_count = 0; + /* The drop processing after over_batch relies on + * rds_send_remove_from_sock() emptying to_be_dropped entry by + * entry; warn if that post-condition ever stops holding, and + * re-initialize the list head. + */ + WARN_ON_ONCE(!list_empty(&to_be_dropped)); + INIT_LIST_HEAD(&to_be_dropped); + /* * sendmsg calls here after having queued its message on the send * queue. We only have one task feeding the connection at a time. If