mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-07-08 18:13:59 +02:00
drbd: Balance RCU calls in drbd_adm_dump_devices()
[ Upstream commit2b31e86387] 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:a55bbd375d("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
d5a23bd861
commit
8092713a10
@@ -3377,8 +3377,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;
|
||||
}
|
||||
}
|
||||
@@ -3627,8 +3629,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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user