* [PATCH] block: queue lock must be acquired when iterating over rls
@ 2017-02-01 6:36 Tahsin Erdogan
2017-02-01 22:31 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Tahsin Erdogan @ 2017-02-01 6:36 UTC (permalink / raw)
To: Jens Axboe, linux-block; +Cc: linux-kernel, Tahsin Erdogan
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 <tahsin@google.com>
---
block/blk-core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/block/blk-core.c b/block/blk-core.c
index 61ba08c58b64..0488a2b55bf0 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -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);
--
2.11.0.483.g087da7b7c-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-02-01 22:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-01 6:36 [PATCH] block: queue lock must be acquired when iterating over rls Tahsin Erdogan
2017-02-01 22:31 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox