From: sashiko-bot@kernel.org
To: "Henry Martin" <bsdhenrymartin@gmail.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH net] rds: fix transport reference leak on rds_add_bound() failure
Date: Sun, 11 Oct 2026 08:15:26 +0000 [thread overview]
Message-ID: <sashiko-outbox-167121@kernel.org> (raw)
In-Reply-To: <20261010081446.3112217-1-bsdhenrymartin@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] net/rds: explicit SO_RDS_TRANSPORT socket option is unpinned on transient bind failure
--
commit e657dc28c34c2b6450919388879a26bad7d1e8e5
Author: Henry Martin <bsdhenrymartin@gmail.com>
rds: fix transport reference leak on rds_add_bound() failure
This commit fixes a transport reference leak in rds_bind() when rds_add_bound()
fails. It drops the reference via rds_trans_put() and sets rs->rs_transport
to NULL in the failure branch.
> diff --git a/net/rds/bind.c b/net/rds/bind.c
> index f800d920d9690..e4667b3128940 100644
> --- a/net/rds/bind.c
> +++ b/net/rds/bind.c
> @@ -264,8 +264,10 @@ int rds_bind(struct socket *sock, struct sockaddr_unsized *uaddr, int addr_len)
>
> sock_set_flag(sk, SOCK_RCU_FREE);
> ret = rds_add_bound(rs, binding_addr, &port, scope_id);
> - if (ret)
> + if (ret) {
> + rds_trans_put(rs->rs_transport);
> rs->rs_transport = NULL;
> + }
[Severity: Medium]
When an explicit transport is configured via setsockopt(SO_RDS_TRANSPORT),
rs->rs_transport is pinned.
If a subsequent bind() fails due to an incompatible address, laddr_check()
fails and returns -ENOPROTOOPT early, which skips the teardown block and
correctly preserves rs->rs_transport.
However, if bind() fails transiently because the port is already in use
(-EADDRINUSE from rds_add_bound()), the modified error path unconditionally
calls rds_trans_put() and clears rs->rs_transport.
Does this destroy the user's explicitly configured socket state on a
transient error, requiring them to silently re-apply the sockopt?
Could we avoid putting and clearing the transport here if it was explicitly
configured prior to calling rds_bind()?
>
> out:
> release_sock(sk);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261010081446.3112217-1-bsdhenrymartin@gmail.com?part=1
next prev parent reply other threads:[~2026-10-11 8:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-10 8:14 [PATCH net] rds: fix transport reference leak on rds_add_bound() failure Henry Martin
2026-10-11 8:15 ` sashiko-bot [this message]
2026-10-11 8:46 ` netdev-bot+sashiko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-167121@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bsdhenrymartin@gmail.com \
--cc=linux-rdma@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox