* [PATCH] drbd: Balance RCU calls in drbd_adm_dump_devices()
@ 2026-03-26 21:40 Bart Van Assche
2026-03-26 21:47 ` Bart Van Assche
2026-03-26 22:05 ` Jens Axboe
0 siblings, 2 replies; 3+ messages in thread
From: Bart Van Assche @ 2026-03-26 21:40 UTC (permalink / raw)
To: Jens Axboe
Cc: linux-block, Christoph Hellwig, Bart Van Assche,
Christoph Böhmwalder, Andreas Gruenbacher, Philipp Reisner,
Lars Ellenberg, Nathan Chancellor
Make drbd_adm_dump_devices() call rcu_read_lock() before
rcu_read_unlock() is called. This has been detected by the Clang
thread-safety analyzer.
Tested-by: Christoph Böhmwalder <christoph.boehmwalder@linbit.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Andreas Gruenbacher <agruenba@redhat.com>
Fixes: a55bbd375d18 ("drbd: Backport the "status" command")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/block/drbd/drbd_nl.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index e18fa260a662..1f8ffdf9b24e 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -3443,8 +3443,10 @@ int drbd_adm_dump_devices(struct sk_buff *skb, struct netlink_callback *cb)
if (resource_filter) {
retcode = ERR_RES_NOT_KNOWN;
resource = drbd_find_resource(nla_data(resource_filter));
- if (!resource)
+ if (!resource) {
+ rcu_read_lock();
goto put_result;
+ }
cb->args[0] = (long)resource;
}
}
@@ -3693,8 +3695,10 @@ int drbd_adm_dump_peer_devices(struct sk_buff *skb, struct netlink_callback *cb)
if (resource_filter) {
retcode = ERR_RES_NOT_KNOWN;
resource = drbd_find_resource(nla_data(resource_filter));
- if (!resource)
+ if (!resource) {
+ rcu_read_lock();
goto put_result;
+ }
}
cb->args[0] = (long)resource;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] drbd: Balance RCU calls in drbd_adm_dump_devices()
2026-03-26 21:40 [PATCH] drbd: Balance RCU calls in drbd_adm_dump_devices() Bart Van Assche
@ 2026-03-26 21:47 ` Bart Van Assche
2026-03-26 22:05 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Bart Van Assche @ 2026-03-26 21:47 UTC (permalink / raw)
To: Jens Axboe
Cc: linux-block, Christoph Hellwig, Christoph Böhmwalder,
Andreas Gruenbacher, Philipp Reisner, Lars Ellenberg,
Nathan Chancellor
On 3/26/26 2:40 PM, Bart Van Assche wrote:
> Make drbd_adm_dump_devices() call rcu_read_lock() before
> rcu_read_unlock() is called. This has been detected by the Clang
> thread-safety analyzer.
(replying to my own email)
Since it is the third time this patch is posted, the changelog is as
follows:
Changes compared to v2:
- Added Christoph Hellwig's Reviewed-by tag.
- Extracted this patch from a larger series.
Changes compared to v1:
- Added Christoph Böhmwalder's Tested-by tag.
Bart.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drbd: Balance RCU calls in drbd_adm_dump_devices()
2026-03-26 21:40 [PATCH] drbd: Balance RCU calls in drbd_adm_dump_devices() Bart Van Assche
2026-03-26 21:47 ` Bart Van Assche
@ 2026-03-26 22:05 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2026-03-26 22:05 UTC (permalink / raw)
To: Bart Van Assche
Cc: linux-block, Christoph Hellwig, Christoph Böhmwalder,
Andreas Gruenbacher, Philipp Reisner, Lars Ellenberg,
Nathan Chancellor
On Thu, 26 Mar 2026 14:40:54 -0700, Bart Van Assche wrote:
> Make drbd_adm_dump_devices() call rcu_read_lock() before
> rcu_read_unlock() is called. This has been detected by the Clang
> thread-safety analyzer.
Applied, thanks!
[1/1] drbd: Balance RCU calls in drbd_adm_dump_devices()
commit: 2b31e86387e60b3689339f0f0fbb4d3623d9d494
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-26 22:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-26 21:40 [PATCH] drbd: Balance RCU calls in drbd_adm_dump_devices() Bart Van Assche
2026-03-26 21:47 ` Bart Van Assche
2026-03-26 22:05 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox