diff options
author | Yu Kuai <yukuai3@huawei.com> | 2022-11-15 22:10:52 +0800 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2022-11-16 15:19:56 -0700 |
commit | 62f535e1f061b4c2cc76061b6b59af9f9335ee34 (patch) | |
tree | 32c2a4bf133cd6831d6226656969d6eefbe16c11 /ipc | |
parent | 7abc077788363ac7194aefd355306f8e974feff7 (diff) | |
download | linux-62f535e1f061b4c2cc76061b6b59af9f9335ee34.tar.gz linux-62f535e1f061b4c2cc76061b6b59af9f9335ee34.tar.bz2 linux-62f535e1f061b4c2cc76061b6b59af9f9335ee34.zip |
block: fix use after free for bd_holder_dir
Currently, the caller of bd_link_disk_holer() get 'bdev' by
blkdev_get_by_dev(), which will look up 'bdev' by inode number 'dev'.
Howerver, it's possible that del_gendisk() can be called currently, and
'bd_holder_dir' can be freed before bd_link_disk_holer() access it, thus
use after free is triggered.
t1: t2:
bdev = blkdev_get_by_dev
del_gendisk
kobject_put(bd_holder_dir)
kobject_free()
bd_link_disk_holder
Fix the problem by checking disk is still live and grabbing a reference
to 'bd_holder_dir' first in bd_link_disk_holder().
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20221115141054.1051801-9-yukuai1@huaweicloud.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'ipc')
0 files changed, 0 insertions, 0 deletions