Re: [PATCH net v7 1/3] net/rds: register the IB transport last
From: netdev-bot+sashiko
Date: Fri Dec 04 2026 - 22:05:44 EST
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@xxxxxxxxxxxxxxxxxxxx>
[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@xxxxxxxxxxxxxxx
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