mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 08:14:15 +08:00
block: clear ->slave_dir when dropping the main slave_dir reference
[ Upstream commitd90db3b1c8
] Zero out the pointer to ->slave_dir so that the holder code doesn't incorrectly treat the object as alive when add_disk failed or after del_gendisk was called. Fixes:89f871af1b
("dm: delay registering the gendisk") Reported-by: Yu Kuai <yukuai3@huawei.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Yu Kuai <yukuai3@huawei.com> Reviewed-by: Mike Snitzer <snitzer@kernel.org> Link: https://lore.kernel.org/r/20221115141054.1051801-2-yukuai1@huaweicloud.com Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
62251948e2
commit
77482c4dd4
@ -530,6 +530,7 @@ out_unregister_queue:
|
||||
rq_qos_exit(disk->queue);
|
||||
out_put_slave_dir:
|
||||
kobject_put(disk->slave_dir);
|
||||
disk->slave_dir = NULL;
|
||||
out_put_holder_dir:
|
||||
kobject_put(disk->part0->bd_holder_dir);
|
||||
out_del_integrity:
|
||||
@ -624,6 +625,7 @@ void del_gendisk(struct gendisk *disk)
|
||||
|
||||
kobject_put(disk->part0->bd_holder_dir);
|
||||
kobject_put(disk->slave_dir);
|
||||
disk->slave_dir = NULL;
|
||||
|
||||
part_stat_set_all(disk->part0, 0);
|
||||
disk->part0->bd_stamp = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user