Message ID | 20220718042408.3132835-1-yangyingliang@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [-next] ublk_drv: fix missing error return code in ublk_add_dev() | expand |
On Mon, Jul 18, 2022 at 12:24:08PM +0800, Yang Yingliang wrote: > If blk_mq_init_queue() fails, it should return error code in ublk_add_dev() > > Fixes: cebbe577cb17 ("ublk_drv: fix request queue leak") > Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> > --- > drivers/block/ublk_drv.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c > index 52fd0af8a4f2..bea441782cb0 100644 > --- a/drivers/block/ublk_drv.c > +++ b/drivers/block/ublk_drv.c > @@ -1169,8 +1169,10 @@ static int ublk_add_dev(struct ublk_device *ub) > goto out_deinit_queues; > > ub->ub_queue = blk_mq_init_queue(&ub->tag_set); > - if (IS_ERR(ub->ub_queue)) > + if (IS_ERR(ub->ub_queue)) { > + err = PTR_ERR(ub->ub_queue); > goto out_cleanup_tags; > + } > ub->ub_queue->queuedata = ub; > > disk = ub->ub_disk = blk_mq_alloc_disk_for_queue(ub->ub_queue, Reviewed-by: Ming Lei <ming.lei@redhat.com> Thanks, Ming
On Mon, 18 Jul 2022 12:24:08 +0800, Yang Yingliang wrote: > If blk_mq_init_queue() fails, it should return error code in ublk_add_dev() > > Applied, thanks! [1/1] ublk_drv: fix missing error return code in ublk_add_dev() commit: f50e5d670c622349277a46996a70386cc3661b10 Best regards,
diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c index 52fd0af8a4f2..bea441782cb0 100644 --- a/drivers/block/ublk_drv.c +++ b/drivers/block/ublk_drv.c @@ -1169,8 +1169,10 @@ static int ublk_add_dev(struct ublk_device *ub) goto out_deinit_queues; ub->ub_queue = blk_mq_init_queue(&ub->tag_set); - if (IS_ERR(ub->ub_queue)) + if (IS_ERR(ub->ub_queue)) { + err = PTR_ERR(ub->ub_queue); goto out_cleanup_tags; + } ub->ub_queue->queuedata = ub; disk = ub->ub_disk = blk_mq_alloc_disk_for_queue(ub->ub_queue,
If blk_mq_init_queue() fails, it should return error code in ublk_add_dev() Fixes: cebbe577cb17 ("ublk_drv: fix request queue leak") Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> --- drivers/block/ublk_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)