All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Stefan Ghetu <stefan.ghetu@nxp.com>
Cc: Han Xu <han.xu@nxp.com>,
	 "sashiko-reviews@lists.linux.dev"
	<sashiko-reviews@lists.linux.dev>,
	 "richard@nod.at" <richard@nod.at>,
	"vigneshr@ti.com" <vigneshr@ti.com>,
	 "s.hauer@pengutronix.de" <s.hauer@pengutronix.de>,
	 "imx@lists.linux.dev" <imx@lists.linux.dev>,
	Daniel Baluta <daniel.baluta@nxp.com>,
	 "linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	 "Frank.Li@kernel.org" <Frank.Li@kernel.org>
Subject: Re: [EXT] Re: [PATCH] mtd: rawnand: gpmi: Fix possible NULL pointer dereference in gpmi_nfc_exec_op()
Date: Mon, 16 Nov 2026 17:12:14 +0100	[thread overview]
Message-ID: <87se10pxgh.fsf@bootlin.com> (raw)
In-Reply-To: <DB7PR04MB4474F2E3C2C31984F1A0C8299D772@DB7PR04MB4474.eurprd04.prod.outlook.com> (Stefan Ghetu's message of "Thu, 5 Nov 2026 10:49:48 +0000")

Hi Stefan,

On 05/11/2026 at 10:49:48 GMT, Stefan Ghetu <stefan.ghetu@nxp.com> wrote:

> Hi,
>
> The review is right.
>
> Moving the !desc check out of the loop lets the loop continue after an
> intermediate gpmi_chain_() failure. That can submit a truncated DMA
> chain and, once get_next_transfer() has returned NULL, index past
> this->transfers[] both in the loop and in the unmap cleanup.
> The original concern does not seem reachable either:
>
> * the continue in the NAND_OP_CMD_INSTR case only happens when the next
>  instruction is NAND_OP_ADDR_INSTR, which sets and checks desc;
> * a zero-length NAND_OP_DATA_IN_INSTR only breaks out of the switch, so
>  the existing in-loop check still catches desc == NULL;
> * the core helpers drop zero-length data instructions (or reject them
>  with -EINVAL), so ->exec_op() never gets an operation without
>
> So the Coverity report looks like a false positive and the current code
> is correct.
>
> Please drop this patch.

Ok, thanks a lot for the feedback.

Miquèl

WARNING: multiple messages have this Message-ID (diff)
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Stefan Ghetu <stefan.ghetu@nxp.com>
Cc: Han Xu <han.xu@nxp.com>,
	 "sashiko-reviews@lists.linux.dev"
	<sashiko-reviews@lists.linux.dev>,
	 "richard@nod.at" <richard@nod.at>,
	"vigneshr@ti.com" <vigneshr@ti.com>,
	 "s.hauer@pengutronix.de" <s.hauer@pengutronix.de>,
	 "imx@lists.linux.dev" <imx@lists.linux.dev>,
	Daniel Baluta <daniel.baluta@nxp.com>,
	 "linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	 "Frank.Li@kernel.org" <Frank.Li@kernel.org>
Subject: Re: [EXT] Re: [PATCH] mtd: rawnand: gpmi: Fix possible NULL pointer dereference in gpmi_nfc_exec_op()
Date: Mon, 16 Nov 2026 17:12:14 +0100	[thread overview]
Message-ID: <87se10pxgh.fsf@bootlin.com> (raw)
In-Reply-To: <DB7PR04MB4474F2E3C2C31984F1A0C8299D772@DB7PR04MB4474.eurprd04.prod.outlook.com> (Stefan Ghetu's message of "Thu, 5 Nov 2026 10:49:48 +0000")

Hi Stefan,

On 05/11/2026 at 10:49:48 GMT, Stefan Ghetu <stefan.ghetu@nxp.com> wrote:

> Hi,
>
> The review is right.
>
> Moving the !desc check out of the loop lets the loop continue after an
> intermediate gpmi_chain_() failure. That can submit a truncated DMA
> chain and, once get_next_transfer() has returned NULL, index past
> this->transfers[] both in the loop and in the unmap cleanup.
> The original concern does not seem reachable either:
>
> * the continue in the NAND_OP_CMD_INSTR case only happens when the next
>  instruction is NAND_OP_ADDR_INSTR, which sets and checks desc;
> * a zero-length NAND_OP_DATA_IN_INSTR only breaks out of the switch, so
>  the existing in-loop check still catches desc == NULL;
> * the core helpers drop zero-length data instructions (or reject them
>  with -EINVAL), so ->exec_op() never gets an operation without
>
> So the Coverity report looks like a false positive and the current code
> is correct.
>
> Please drop this patch.

Ok, thanks a lot for the feedback.

Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  parent reply	other threads:[~2026-11-16 16:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05 10:34 [PATCH] mtd: rawnand: gpmi: Fix possible NULL pointer dereference in gpmi_nfc_exec_op() Stefan Ghetu
2026-11-05 10:34 ` Stefan Ghetu
2026-11-05 10:39 ` sashiko-bot
2026-11-05 10:39   ` sashiko-bot
     [not found]   ` <DB7PR04MB4474F2E3C2C31984F1A0C8299D772@DB7PR04MB4474.eurprd04.prod.outlook.com>
2026-11-16 16:12     ` Miquel Raynal [this message]
2026-11-16 16:12       ` [EXT] " Miquel Raynal

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=87se10pxgh.fsf@bootlin.com \
    --to=miquel.raynal@bootlin.com \
    --cc=Frank.Li@kernel.org \
    --cc=daniel.baluta@nxp.com \
    --cc=han.xu@nxp.com \
    --cc=imx@lists.linux.dev \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    --cc=s.hauer@pengutronix.de \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=stefan.ghetu@nxp.com \
    --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 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.