Commit d4a6a447 authored by Yu Kuai's avatar Yu Kuai Committed by Yang Yingliang
Browse files

block: error out if blk_get_queue() failed in blk_init_rl()



hulk inclusion
category: bugfix
bugzilla: 174635
CVE: NA

-----------------------------------------------

If blkg creation concurrent with device removal, queue ref might be
unbalanced:

t1                      t2                    t3
                                              cgroup_file_write
                                               blkg_conf_prep
                                                q = disk->queue
dm_ctl_ioctl
 dev_remove
  blk_cleanup_queue
   queue_flag_set(QUEUE_FLAG_DYING, q)
                                                blkg_alloc
                                                 blk_init_cl
                                                  blk_get_queue -> failed
   blk_exit_queue
    blkcg_exit_queue
     blkg_destroy_all
      blkg_destroy
       call_rcu(&blkg->rcu_head, __blkg_release_rcu);

                        __blkg_release_rcu
                         blkg_free
                          blk_exit_rl
                           blk_put_queue -> extra put

Thus error out if blk_get_queue() failed in blk_init_rl(), since there
is no need to create blkg while queue is dying.

Signed-off-by: default avatarYu Kuai <yukuai3@huawei.com>
Reviewed-by: default avatarHou Tao <houtao1@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parent 5b8d27dd
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment