From: Eduard Zateev <hackerowskiy@gmail.com>
To: achender@kernel.org
Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.com, horms@kernel.org, netdev@vger.kernel.org,
linux-rdma@vger.kernel.org, rds-devel@oss.oracle.com,
linux-kernel@vger.kernel.org,
Eduard Zateev <hackerowskiy@gmail.com>,
syzbot+221e213bf17f17e0d6cd@syzkaller.appspotmail.com
Subject: [PATCH] net/rds: hold IB device reference through deferred cleanup
Date: Fri, 23 Oct 2026 12:02:06 +0200 [thread overview]
Message-ID: <20261023100206.126692-1-hackerowskiy@gmail.com> (raw)
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
reply other threads:[~2026-10-23 10:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261023100206.126692-1-hackerowskiy@gmail.com \
--to=hackerowskiy@gmail.com \
--cc=achender@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rds-devel@oss.oracle.com \
--cc=syzbot+221e213bf17f17e0d6cd@syzkaller.appspotmail.com \
/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
all inboxes | Powered by JetHome®