* [PATCH] nullblk: Fix cleanup order in null_add_dev() error path
@ 2024-03-30 0:53 Damien Le Moal
2024-03-30 5:49 ` Christoph Hellwig
2024-03-30 15:56 ` Jens Axboe
0 siblings, 2 replies; 3+ messages in thread
From: Damien Le Moal @ 2024-03-30 0:53 UTC (permalink / raw)
To: Jens Axboe, linux-block; +Cc: Christoph Hellwig
In null_add_dev(), if an error happen after initializing the resources
for a zoned null block device, we must free these resources before
exiting the function. To ensure this, move the out_cleanup_zone label
after out_cleanup_disk as we jump to this latter label if an error
happens after calling null_init_zoned_dev().
Fixes: e440626b1caf ("null_blk: pass queue_limits to blk_mq_alloc_disk")
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
drivers/block/null_blk/main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index 71c39bcd872c..ed33cf7192d2 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -1965,10 +1965,10 @@ static int null_add_dev(struct nullb_device *dev)
out_ida_free:
ida_free(&nullb_indexes, nullb->index);
-out_cleanup_zone:
- null_free_zoned_dev(dev);
out_cleanup_disk:
put_disk(nullb->disk);
+out_cleanup_zone:
+ null_free_zoned_dev(dev);
out_cleanup_tags:
if (nullb->tag_set == &nullb->__tag_set)
blk_mq_free_tag_set(nullb->tag_set);
--
2.44.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] nullblk: Fix cleanup order in null_add_dev() error path
2024-03-30 0:53 [PATCH] nullblk: Fix cleanup order in null_add_dev() error path Damien Le Moal
@ 2024-03-30 5:49 ` Christoph Hellwig
2024-03-30 15:56 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2024-03-30 5:49 UTC (permalink / raw)
To: Damien Le Moal; +Cc: Jens Axboe, linux-block, Christoph Hellwig
On Sat, Mar 30, 2024 at 09:53:00AM +0900, Damien Le Moal wrote:
> In null_add_dev(), if an error happen after initializing the resources
> for a zoned null block device, we must free these resources before
> exiting the function. To ensure this, move the out_cleanup_zone label
> after out_cleanup_disk as we jump to this latter label if an error
> happens after calling null_init_zoned_dev().
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nullblk: Fix cleanup order in null_add_dev() error path
2024-03-30 0:53 [PATCH] nullblk: Fix cleanup order in null_add_dev() error path Damien Le Moal
2024-03-30 5:49 ` Christoph Hellwig
@ 2024-03-30 15:56 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2024-03-30 15:56 UTC (permalink / raw)
To: linux-block, Damien Le Moal; +Cc: Christoph Hellwig
On Sat, 30 Mar 2024 09:53:00 +0900, Damien Le Moal wrote:
> In null_add_dev(), if an error happen after initializing the resources
> for a zoned null block device, we must free these resources before
> exiting the function. To ensure this, move the out_cleanup_zone label
> after out_cleanup_disk as we jump to this latter label if an error
> happens after calling null_init_zoned_dev().
>
>
> [...]
Applied, thanks!
[1/1] nullblk: Fix cleanup order in null_add_dev() error path
commit: a057e4036487351ad25002a88c75f7d195e36d79
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-03-30 15:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-30 0:53 [PATCH] nullblk: Fix cleanup order in null_add_dev() error path Damien Le Moal
2024-03-30 5:49 ` Christoph Hellwig
2024-03-30 15:56 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox