Message ID | 1565686784-50375-2-git-send-email-zhengbin13@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | paride/pf: need to set queue to NULL before put_disk | expand |
ping On 2019/8/13 16:59, zhengbin wrote: > In pf_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: 77218ddf46d8 ("paride: convert pf to blk-mq") > Reported-by: Hulk Robot <hulkci@huawei.com> > Signed-off-by: zhengbin <zhengbin13@huawei.com> > --- > drivers/block/paride/pf.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c > index 1e9c50a..6b7d4ca 100644 > --- a/drivers/block/paride/pf.c > +++ b/drivers/block/paride/pf.c > @@ -300,8 +300,8 @@ static void __init pf_init_units(void) > disk->queue = blk_mq_init_sq_queue(&pf->tag_set, &pf_mq_ops, > 1, BLK_MQ_F_SHOULD_MERGE); > if (IS_ERR(disk->queue)) { > - put_disk(disk); > disk->queue = NULL; > + put_disk(disk); > continue; > } > > -- > 2.7.4 > > > . >
On 8/13/19 2:59 AM, zhengbin wrote: > In pf_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) Thanks, applied.
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c index 1e9c50a..6b7d4ca 100644 --- a/drivers/block/paride/pf.c +++ b/drivers/block/paride/pf.c @@ -300,8 +300,8 @@ static void __init pf_init_units(void) disk->queue = blk_mq_init_sq_queue(&pf->tag_set, &pf_mq_ops, 1, BLK_MQ_F_SHOULD_MERGE); if (IS_ERR(disk->queue)) { - put_disk(disk); disk->queue = NULL; + put_disk(disk); continue; }
In pf_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: 77218ddf46d8 ("paride: convert pf to blk-mq") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: zhengbin <zhengbin13@huawei.com> --- drivers/block/paride/pf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4