Message ID | 20190318140703.28963-3-yuyufen@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | fix use-after-free of gendisk | expand |
diff --git a/block/genhd.c b/block/genhd.c index f00198e6758a..961b2bc4634f 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -522,9 +522,6 @@ int blk_alloc_devt(struct hd_struct *part, dev_t *devt) */ void blk_free_devt(dev_t devt) { - if (devt == MKDEV(0, 0)) - return; - if (MAJOR(devt) == BLOCK_EXT_MAJOR) { spin_lock_bh(&ext_devt_lock); idr_remove(&ext_devt_idr, blk_mangle_minor(MINOR(devt)));
If devt is MKDEV(0, 0), its MAJOR cannot be BLOCK_EXT_MAJOR, so, I think we can remove the statement. Signed-off-by: Yufen Yu <yuyufen@huawei.com> --- block/genhd.c | 3 --- 1 file changed, 3 deletions(-)