drbd: Balance RCU calls in drbd_adm_dump_devices()
Subsystems (2)
PATCH 1/1 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.
--- drivers/block/drbd/drbd_nl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/block/drbd/drbd_nl.c +6 -2
@@ -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; }
Quoted 3 lines · Bart Van Assche
Make
drbd_adm_dump_devices()callrcu_read_lock()beforercu_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.
Quoted 3 lines · Bart Van Assche
Make
drbd_adm_dump_devices()callrcu_read_lock()beforercu_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,
Signature · 1 line
Jens Axboe