Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: chenaibing@cmss.chinamobile.com
Cc: achender@kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, kuba@kernel.org
Subject: Re: [PATCH net v7 1/3] net/rds: register the IB transport last
Date: Sat, 05 Dec 2026 03:05:35 +0000	[thread overview]
Message-ID: <179643993556.3146.8810501964132839504@kernel.org> (raw)
In-Reply-To: <20261204022245.381-2-chenaibing@cmss.chinamobile.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] Commit "net/rds: register the IB transport last" fixes a use-
  after-free of module memory that users can trigger, but its commit…

--

net/rds: register the IB transport last

This patch moves rds_trans_register(&rds_ib_transport) out of
rds_ib_init(). It now runs in rds_rdma_init(), after
rds_rdma_listen_init() succeeds, and the matching rds_trans_unregister()
moves into rds_rdma_exit(). As a result, rds_trans_get_preferred() can
no longer find the transport while the module can still fail to
initialize.

> Register the transport only once the listener is up, so that it is never
> reachable from a module that can still fail to initialize, and unregister
> it in rds_rdma_exit() before the transport is torn down.
>
> Signed-off-by: Aibing Chen <chenaibing@cmss.chinamobile.com>

[Severity: Medium]
Should this patch carry Fixes: and Cc: stable tags?

The window described in the commit message seems to come from commit
8d5d8a5fd7f9 ("RDS: RDMA: start rdma listening after init"). That commit
moved rds_rdma_listen_init() after rds_ib_init(). Before it, nothing in
rds_rdma_init() could fail once rds_trans_register() had run.

A bind() or setsockopt(SO_RDS_TRANSPORT) can race with a failed load.
Either call can find the transport through rds_trans_get_preferred() or
rds_trans_get(), and try_module_get() succeeds on a module in
MODULE_STATE_COMING. A later rds_trans_put() then reads trans->t_owner
from the freed rds_ib_transport.

Something like:

Fixes: 8d5d8a5fd7f9 ("RDS: RDMA: start rdma listening after init")
Cc: stable@vger.kernel.org

The next patch in the series, "net/rds: drop rds_trans_sem around
laddr_check()", is tagged for stable, and its commit message depends on
this one:

    The transport is only registered once rds_rdma_init() can no longer
    fail, so the reference cannot be taken on a module that is about to
    be freed.

Suppose stable takes that patch without this one. Then
rds_trans_unregister() no longer waits for a laddr_check() that is
already running. After a failed init, rds_ib_laddr_check() could then
run in freed module text.

Could this patch be tagged so that both are backported together?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204022245.381-1-chenaibing%40cmss.chinamobile.com

  reply	other threads:[~2026-12-05  3:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04  2:22 [PATCH net v7 0/3] net/rds: fix the probe cm_id lock ordering Aibing Chen
2026-12-04  2:22 ` [PATCH net v7 1/3] net/rds: register the IB transport last Aibing Chen
2026-12-05  3:05   ` netdev-bot+sashiko [this message]
2026-12-04  2:22 ` [PATCH net v7 2/3] net/rds: drop rds_trans_sem around laddr_check() Aibing Chen
2026-12-05  3:05   ` netdev-bot+sashiko
2026-12-04  2:22 ` [PATCH net v7 3/3] net/rds: defer the probe cm_id destroy to rds_wq Aibing Chen
2026-12-05  3:05   ` 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=179643993556.3146.8810501964132839504@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=achender@kernel.org \
    --cc=chenaibing@cmss.chinamobile.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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