diff options
| author | Atharva Vartak <atharva.a.vartak@gmail.com> | 2026-10-07 00:00:09 -0400 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2026-10-15 16:56:37 -0700 |
| commit | e6435b2cc5fdf008cdb67ad9a811a266e8ac9c1e (patch) | |
| tree | 5d996dbc964d087d8223c278dcb62cd3e3d33cac /scripts/basic | |
| parent | 07380336e09d796bb176c3a100088024d52fadd3 (diff) | |
net/smc: hold a reference on net_device returned by pnet_find_base_ndev()
pnet_find_base_ndev() resolves the base net_device for stacked devices
under RTNL, then drops the lock and returns the raw pointer without
taking a reference. All three callers dereference the pointer after
RTNL has been released, creating a use-after-free window if the device
is concurrently unregistered.
Take a reference with netdev_hold() before dropping RTNL and add the
matching netdev_put() in every return path of the three callers:
- smc_pnet_add_eth()
- smc_pnet_find_roce_by_pnetid()
- smc_pnet_find_ism_by_pnetid()
Found by code analysis, confirmed with a proof-of-concept that triggers
a KASAN slab-use-after-free report.
Fixes: 0afff91c6f5e ("net/smc: add pnetid support")
Fixes: 1619f770589a ("net/smc: add pnetid support for SMC-D and ISM")
Cc: "D. Wythe" <alibuda@linux.alibaba.com>
Cc: Dust Li <dust.li@linux.alibaba.com>
Cc: Sidraya Jayagond <sidraya@linux.ibm.com>
Cc: Mahanta Jambigi <mjambigi@linux.ibm.com>
Cc: Tony Lu <tonylu@linux.alibaba.com>
Cc: Wen Gu <guwen@linux.alibaba.com>
Cc: Willy Tarreau <w@1wt.eu>
Signed-off-by: Atharva Vartak <atharva.a.vartak@gmail.com>
Link: https://patch.msgid.link/20261007040009.137568-1-atharva.a.vartak@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'scripts/basic')
0 files changed, 0 insertions, 0 deletions
