block: queue lock must be acquired when iterating over rls
PATCH 1/1 block: queue lock must be acquired when iterating over rls
blk_set_queue_dying() does not acquire queue lock before it calls blk_queue_for_each_rl(). This allows a racing blkg_destroy() to remove blkg->q_node from the linked list and have blk_queue_for_each_rl() loop infitely over the removed blkg->q_node list node.
Signed-off-by Tahsin Erdogan <[email protected]>
--- block/blk-core.c | 2 ++ 1 file changed, 2 insertions(+)
block/blk-core.c +2 -0
@@ -525,12 +525,14 @@ void blk_set_queue_dying(struct request_queue *q)else {struct request_list *rl; +spin_lock_irq (q->queue_lock);blk_queue_for_each_rl (rl, q) {if (rl->rq_pool) {wake_up (&rl->wait[BLK_RW_SYNC ]);wake_up (&rl->wait[BLK_RW_ASYNC ]); } } +spin_unlock_irq (q->queue_lock); } }EXPORT_SYMBOL_GPL (blk_set_queue_dying);
Signature · 1 line
2.11.0.483.g087da7b7c-goog
Quoted 5 lines · Tahsin Erdogan
blk_set_queue_dying()does not acquire queue lock before it callsblk_queue_for_each_rl(). This allows a racingblkg_destroy()to removeblkg->q_nodefrom the linked list and haveblk_queue_for_each_rl()loop infitely over the removedblkg->q_nodelist node.
Thanks, applied.
Signature · 1 line
Jens Axboe