This is a note to let you know that I've just added the patch titled blk-cgroup: hold queue_lock when removing blkg->q_node to the 6.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: blk-cgroup-hold-queue_lock-when-removing-blkg-q_node.patch and it can be found in the queue-6.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From c164c7bc9775be7bcc68754bb3431fce5823822e Mon Sep 17 00:00:00 2001 From: Ming Lei <ming.lei@xxxxxxxxxx> Date: Thu, 17 Aug 2023 22:17:51 +0800 Subject: blk-cgroup: hold queue_lock when removing blkg->q_node From: Ming Lei <ming.lei@xxxxxxxxxx> commit c164c7bc9775be7bcc68754bb3431fce5823822e upstream. When blkg is removed from q->blkg_list from blkg_free_workfn(), queue_lock has to be held, otherwise, all kinds of bugs(list corruption, hard lockup, ..) can be triggered from blkg_destroy_all(). Fixes: f1c006f1c685 ("blk-cgroup: synchronize pd_free_fn() from blkg_free_workfn() and blkcg_deactivate_policy()") Cc: Yu Kuai <yukuai3@xxxxxxxxxx> Cc: xiaoli feng <xifeng@xxxxxxxxxx> Cc: Chunyu Hu <chuhu@xxxxxxxxxx> Cc: Mike Snitzer <snitzer@xxxxxxxxxx> Cc: Tejun Heo <tj@xxxxxxxxxx> Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx> Acked-by: Tejun Heo <tj@xxxxxxxxxx> Link: https://lore.kernel.org/r/20230817141751.1128970-1-ming.lei@xxxxxxxxxx Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- block/blk-cgroup.c | 2 ++ 1 file changed, 2 insertions(+) --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -136,7 +136,9 @@ static void blkg_free_workfn(struct work blkcg_policy[i]->pd_free_fn(blkg->pd[i]); if (blkg->parent) blkg_put(blkg->parent); + spin_lock_irq(&q->queue_lock); list_del_init(&blkg->q_node); + spin_unlock_irq(&q->queue_lock); mutex_unlock(&q->blkcg_mutex); blk_put_queue(q); Patches currently in stable-queue which might be from ming.lei@xxxxxxxxxx are queue-6.4/blk-cgroup-hold-queue_lock-when-removing-blkg-q_node.patch