* [PATCH] net/rds: hold IB device reference through deferred cleanup
@ 2026-10-23 10:02 Eduard Zateev
0 siblings, 0 replies; only message in thread
From: Eduard Zateev @ 2026-10-23 10:02 UTC (permalink / raw)
To: achender
Cc: davem, edumazet, kuba, pabeni, horms, netdev, linux-rdma,
rds-devel, linux-kernel, Eduard Zateev,
syzbot+221e213bf17f17e0d6cd
RDS device teardown queues rds_ib_dev_free() on rds_wq. Hold a
reference to the underlying IB device until deferred cleanup releases
its resources. This prevents device removal from freeing it while the
work is running.
Reported-by: syzbot+221e213bf17f17e0d6cd@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=221e213bf17f17e0d6cd
Signed-off-by: Eduard Zateev <hackerowskiy@gmail.com>
---
net/rds/ib.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/net/rds/ib.c b/net/rds/ib.c
index 786f39169bc..597872e4fe9 100644
--- a/net/rds/ib.c
+++ b/net/rds/ib.c
@@ -115,6 +115,7 @@ static void rds_ib_dev_free(struct work_struct *work)
kfree(rds_ibdev->vector_load);
+ ib_device_put(rds_ibdev->dev);
kfree(rds_ibdev);
}
@@ -142,6 +143,12 @@ static int rds_ib_add_one(struct ib_device *device)
ibdev_to_node(device));
if (!rds_ibdev)
return -ENOMEM;
+ /* Keep the device registered until the deferred cleanup completes. */
+ if (!ib_device_try_get(device)) {
+ kfree(rds_ibdev);
+ return -ENODEV;
+ }
+ rds_ibdev->dev = device;
spin_lock_init(&rds_ibdev->spinlock);
refcount_set(&rds_ibdev->refcount, 1);
@@ -180,7 +187,6 @@ static int rds_ib_add_one(struct ib_device *device)
goto put_dev;
}
- rds_ibdev->dev = device;
rds_ibdev->pd = ib_alloc_pd(device, 0);
if (IS_ERR(rds_ibdev->pd)) {
ret = PTR_ERR(rds_ibdev->pd);
--
2.55.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-23 10:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-23 10:02 [PATCH] net/rds: hold IB device reference through deferred cleanup Eduard Zateev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®