From: Dan Carpenter <error27@gmail.com>
To: Luca Ceresoli <luca.ceresoli@bootlin.com>
Cc: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>,
Miquel Raynal <miquel.raynal@bootlin.com>,
Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>,
Amit Kumar Mahapatra <amit.kumar-mahapatra@amd.com>,
linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] mtd: virt_concat: fix use-after-free in mtd_virt_concat_destroy_joins()
Date: Tue, 16 Jun 2026 13:13:13 +0300 [thread overview]
Message-ID: <ajEhuS8xwcX1AA_I@stanley.mountain> (raw)
In-Reply-To: <DJADQJ8GEDNF.334T2EXRX7DXJ@bootlin.com>
On Tue, Jun 16, 2026 at 11:51:53AM +0200, Luca Ceresoli wrote:
> Issue 2: in mtd_virt_concat_destroy_joins():
>
> list_for_each_entry_safe(item, tmp, &concat_node_list, head) {
> mtd = &item->concat->mtd; [0]
> if (item->concat) { [1]
>
> At line [0] we dereference item->concat, but at line [1] we apparently
> handle the case where item->concat can be NULL. Either [1] is always true
> and we can remove the if(), or [1] can be false, so [0] is a bug and should
> probably be moved to inside the if().
That's not a dereference on line 0, it's pointer math. So the code
works. But a lot of people find the distinction confusing.
regards,
dan carpenter
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2026-06-16 10:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-14 8:10 [PATCH] mtd: virt_concat: fix use-after-free in mtd_virt_concat_destroy_joins() Harshit Mogalapalli
2026-06-16 9:51 ` Luca Ceresoli
2026-06-16 10:13 ` Dan Carpenter [this message]
2026-06-16 20:31 ` Luca Ceresoli
2026-06-16 12:25 ` Harshit Mogalapalli
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=ajEhuS8xwcX1AA_I@stanley.mountain \
--to=error27@gmail.com \
--cc=amit.kumar-mahapatra@amd.com \
--cc=harshit.m.mogalapalli@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=luca.ceresoli@bootlin.com \
--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