* [PATCH] blk-cgroup: fix freeing NULL blkg in blkg_create
@ 2023-02-06 15:02 Christoph Hellwig
2023-02-06 15:25 ` Chaitanya Kulkarni
2023-02-06 15:43 ` Jens Axboe
0 siblings, 2 replies; 3+ messages in thread
From: Christoph Hellwig @ 2023-02-06 15:02 UTC (permalink / raw)
To: axboe; +Cc: linux-block, Yi Zhang
new_blkg can be NULL if the caller didn't pass in a pre-allocated blkg.
Don't try to free it in that case.
Fixes: 27b642b07a4a ("blk-cgroup: simplify blkg freeing from initialization failure paths")
Reported-by: Yi Zhang <yi.zhang@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
block/blk-cgroup.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 8faeca6022bea0..c46778d1f3c27d 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -383,7 +383,8 @@ static struct blkcg_gq *blkg_create(struct blkcg *blkcg, struct gendisk *disk,
err_put_css:
css_put(&blkcg->css);
err_free_blkg:
- blkg_free(new_blkg);
+ if (new_blkg)
+ blkg_free(new_blkg);
return ERR_PTR(ret);
}
--
2.39.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] blk-cgroup: fix freeing NULL blkg in blkg_create
2023-02-06 15:02 [PATCH] blk-cgroup: fix freeing NULL blkg in blkg_create Christoph Hellwig
@ 2023-02-06 15:25 ` Chaitanya Kulkarni
2023-02-06 15:43 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Chaitanya Kulkarni @ 2023-02-06 15:25 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-block, axboe, Yi Zhang
On 2/6/23 07:02, Christoph Hellwig wrote:
> new_blkg can be NULL if the caller didn't pass in a pre-allocated blkg.
> Don't try to free it in that case.
>
> Fixes: 27b642b07a4a ("blk-cgroup: simplify blkg freeing from initialization failure paths")
> Reported-by: Yi Zhang <yi.zhang@redhat.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
This should fix the issue reported by Yi, it will be great
to get tested by though.
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
-ck
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] blk-cgroup: fix freeing NULL blkg in blkg_create
2023-02-06 15:02 [PATCH] blk-cgroup: fix freeing NULL blkg in blkg_create Christoph Hellwig
2023-02-06 15:25 ` Chaitanya Kulkarni
@ 2023-02-06 15:43 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2023-02-06 15:43 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-block, Yi Zhang
On Mon, 06 Feb 2023 16:02:01 +0100, Christoph Hellwig wrote:
> new_blkg can be NULL if the caller didn't pass in a pre-allocated blkg.
> Don't try to free it in that case.
>
>
Applied, thanks!
[1/1] blk-cgroup: fix freeing NULL blkg in blkg_create
commit: 28e538a3093833cbac3e28dd511a8b74629d737a
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-02-06 15:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-06 15:02 [PATCH] blk-cgroup: fix freeing NULL blkg in blkg_create Christoph Hellwig
2023-02-06 15:25 ` Chaitanya Kulkarni
2023-02-06 15:43 ` Jens Axboe
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.