Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drbd: Balance RCU calls in drbd_adm_dump_devices()

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>
Link: https://patch.msgid.link/20260326214054.284593-1-bvanassche@acm.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Bart Van Assche and committed by
Jens Axboe
2b31e863 630bbba4

+6 -2
+6 -2
drivers/block/drbd/drbd_nl.c
··· 3443 3443 if (resource_filter) { 3444 3444 retcode = ERR_RES_NOT_KNOWN; 3445 3445 resource = drbd_find_resource(nla_data(resource_filter)); 3446 - if (!resource) 3446 + if (!resource) { 3447 + rcu_read_lock(); 3447 3448 goto put_result; 3449 + } 3448 3450 cb->args[0] = (long)resource; 3449 3451 } 3450 3452 } ··· 3695 3693 if (resource_filter) { 3696 3694 retcode = ERR_RES_NOT_KNOWN; 3697 3695 resource = drbd_find_resource(nla_data(resource_filter)); 3698 - if (!resource) 3696 + if (!resource) { 3697 + rcu_read_lock(); 3699 3698 goto put_result; 3699 + } 3700 3700 } 3701 3701 cb->args[0] = (long)resource; 3702 3702 }