From: Zhihao Cheng <chengzhihao1@huawei.com>
To: Yuho Choi <dbgh9129@gmail.com>, <richard@nod.at>
Cc: <miquel.raynal@bootlin.com>, <vigneshr@ti.com>,
<linux-mtd@lists.infradead.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1] mtd: ubi: Release device reference on busy detach
Date: Sat, 8 Aug 2026 09:50:18 +0800 [thread overview]
Message-ID: <27eaa6d4-cae1-2e44-6b46-a753c2475c50@huawei.com> (raw)
In-Reply-To: <20260807204550.1016755-1-dbgh9129@gmail.com>
在 2026/8/8 4:45, Yuho Choi 写道:
> ubi_detach_mtd_dev() obtains a device reference through ubi_get_device()
> before checking whether the UBI device is busy. The busy return path drops
> ubi->ref_count but leaves the device reference held, so the device object
> cannot be released after a later detach.
>
> Drop the device reference before returning -EBUSY.
>
> Fixes: 7e84c961b2eb ("mtd: ubi: introduce pre-removal notification for UBI volumes")
> Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
> ---
> drivers/mtd/ubi/build.c | 1 +
> 1 file changed, 1 insertion(+)
I think you have sent this patch before?
https://lore.kernel.org/linux-mtd/26c9c959-a3b6-e1de-1215-887990a46870@huawei.com/
>
> diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
> index 674ad87809df..ee6ce4471b25 100644
> --- a/drivers/mtd/ubi/build.c
> +++ b/drivers/mtd/ubi/build.c
> @@ -1105,6 +1105,7 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway)
> ubi->ref_count -= 1;
> if (ubi->ref_count) {
> if (!anyway) {
> + put_device(&ubi->dev);
> spin_unlock(&ubi_devices_lock);
> return -EBUSY;
> }
>
next prev parent reply other threads:[~2026-08-08 1:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-07 20:45 Yuho Choi
2026-08-08 1:50 ` Zhihao Cheng [this message]
2026-08-11 22:10 ` Richard Weinberger
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=27eaa6d4-cae1-2e44-6b46-a753c2475c50@huawei.com \
--to=chengzhihao1@huawei.com \
--cc=dbgh9129@gmail.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 \
/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®