diff options
author | zhengbin <zhengbin13@huawei.com> | 2019-08-13 14:27:40 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2019-09-04 16:01:02 +0300 |
commit | d821cce8ac4625ceecabb9c9e2420daaf41d41d8 (patch) | |
tree | d959fdc796f3db1c7c06d7f626c5462c4ce79d7a /drivers/block/paride/pcd.c | |
parent | ecf4d59a4ebf1237bde1cb2de71a0a6e927d4b0c (diff) | |
download | linux-d821cce8ac4625ceecabb9c9e2420daaf41d41d8.tar.xz |
paride/pcd: need to set queue to NULL before put_disk
In pcd_init_units, if blk_mq_init_sq_queue fails, need to set queue to
NULL before put_disk, otherwise null-ptr-deref Read will occur.
put_disk
kobject_put
disk_release
blk_put_queue(disk->queue)
Fixes: f0d176255401 ("paride/pcd: Fix potential NULL pointer dereference and mem leak")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/paride/pcd.c')
-rw-r--r-- | drivers/block/paride/pcd.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c index 001dbdcbf355..bfca80dde7db 100644 --- a/drivers/block/paride/pcd.c +++ b/drivers/block/paride/pcd.c @@ -314,8 +314,8 @@ static void pcd_init_units(void) disk->queue = blk_mq_init_sq_queue(&cd->tag_set, &pcd_mq_ops, 1, BLK_MQ_F_SHOULD_MERGE); if (IS_ERR(disk->queue)) { - put_disk(disk); disk->queue = NULL; + put_disk(disk); continue; } |