From: Li Nan <linan666@huaweicloud.com>
To: linan666@huaweicloud.com, richard@nod.at,
miquel.raynal@bootlin.com, vigneshr@ti.com
Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
yukuai3@huawei.com, yi.zhang@huawei.com, houtao1@huawei.com,
yangerkun@huawei.com
Subject: Re: [PATCH v2] ubi: block: fix memleak in ubiblock_create()
Date: Mon, 29 Jan 2024 21:27:59 +0800 [thread overview]
Message-ID: <eac2fbfe-5565-96ad-68cb-11efa8af2ec8@huaweicloud.com> (raw)
In-Reply-To: <20231208074629.1656356-1-linan666@huaweicloud.com>
friendly ping ...
在 2023/12/8 15:46, linan666@huaweicloud.com 写道:
> From: Li Nan <linan122@huawei.com>
>
> If idr_alloc() fails, dev->gd will be put after goto out_cleanup_disk in
> ubiblock_create(), but dev->gd has not been assigned yet at this time, and
> 'gd' will not be put anymore. Fix it by putting 'gd' directly.
>
> Signed-off-by: Li Nan <linan122@huawei.com>
> Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
> ---
> Changes in v2:
> - modify the description of the problem in log
>
> drivers/mtd/ubi/block.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c
> index 309a42aeaa4c..654bd7372cd8 100644
> --- a/drivers/mtd/ubi/block.c
> +++ b/drivers/mtd/ubi/block.c
> @@ -434,7 +434,7 @@ int ubiblock_create(struct ubi_volume_info *vi)
> list_del(&dev->list);
> idr_remove(&ubiblock_minor_idr, gd->first_minor);
> out_cleanup_disk:
> - put_disk(dev->gd);
> + put_disk(gd);
> out_free_tags:
> blk_mq_free_tag_set(&dev->tag_set);
> out_free_dev:
--
Thanks,
Nan
next prev parent reply other threads:[~2024-01-29 13:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-08 7:46 linan666
2023-12-30 6:33 ` Li Nan
2024-01-29 13:27 ` Li Nan [this message]
2024-04-14 9:16 ` Markus Elfring
2024-04-15 1:31 ` Li Nan
2024-04-15 6:33 ` Dan Carpenter
2024-04-18 9:07 ` Li Nan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=eac2fbfe-5565-96ad-68cb-11efa8af2ec8@huaweicloud.com \
--to=linan666@huaweicloud.com \
--cc=houtao1@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
--cc=vigneshr@ti.com \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.com \
--cc=yukuai3@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®