public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH next] mtd: spi-nor: hisi-sfc: fix refcounting bug in hisi_spi_nor_register_all()
       [not found] <caa37f28-a2e8-4e0a-a9ce-a365ce805e4b@stanley.mountain>
@ 2026-02-06 13:38 ` Dan Carpenter
  2026-02-06 14:14   ` Pratyush Yadav
  2026-02-06 14:23   ` Miquel Raynal
  0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2026-02-06 13:38 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, linux-mtd, linux-kernel,
	kernel-janitors

This was converted to a _scoped() loop but this of_node_put() was
accidentally left behind which is a double free.

Fixes: aa8cb72c2018 ("mtd: spi-nor: hisi-sfc: Simplify with scoped for each OF child loop")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/mtd/spi-nor/controllers/hisi-sfc.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/mtd/spi-nor/controllers/hisi-sfc.c b/drivers/mtd/spi-nor/controllers/hisi-sfc.c
index 54c49a8423a2..6897ced2d57b 100644
--- a/drivers/mtd/spi-nor/controllers/hisi-sfc.c
+++ b/drivers/mtd/spi-nor/controllers/hisi-sfc.c
@@ -403,7 +403,6 @@ static int hisi_spi_nor_register_all(struct hifmc_host *host)
 
 		if (host->num_chip == HIFMC_MAX_CHIP_NUM) {
 			dev_warn(dev, "Flash device number exceeds the maximum chipselect number\n");
-			of_node_put(np);
 			break;
 		}
 	}
-- 
2.51.0


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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH next] mtd: spi-nor: hisi-sfc: fix refcounting bug in hisi_spi_nor_register_all()
  2026-02-06 13:38 ` [PATCH next] mtd: spi-nor: hisi-sfc: fix refcounting bug in hisi_spi_nor_register_all() Dan Carpenter
@ 2026-02-06 14:14   ` Pratyush Yadav
  2026-02-06 14:22     ` Miquel Raynal
  2026-02-06 14:23   ` Miquel Raynal
  1 sibling, 1 reply; 4+ messages in thread
From: Pratyush Yadav @ 2026-02-06 14:14 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Krzysztof Kozlowski, Tudor Ambarus, Pratyush Yadav, Michael Walle,
	Miquel Raynal, Richard Weinberger, Vignesh Raghavendra, linux-mtd,
	linux-kernel, kernel-janitors

On Fri, Feb 06 2026, Dan Carpenter wrote:

> This was converted to a _scoped() loop but this of_node_put() was
> accidentally left behind which is a double free.
>
> Fixes: aa8cb72c2018 ("mtd: spi-nor: hisi-sfc: Simplify with scoped for each OF child loop")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Reviewed-by: Pratyush Yadav <pratyush@kernel.org>

Miquel, since you took the original patch through the NAND tree, can you
please take this one too?

[...]

-- 
Regards,
Pratyush Yadav

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH next] mtd: spi-nor: hisi-sfc: fix refcounting bug in hisi_spi_nor_register_all()
  2026-02-06 14:14   ` Pratyush Yadav
@ 2026-02-06 14:22     ` Miquel Raynal
  0 siblings, 0 replies; 4+ messages in thread
From: Miquel Raynal @ 2026-02-06 14:22 UTC (permalink / raw)
  To: Pratyush Yadav
  Cc: Dan Carpenter, Krzysztof Kozlowski, Tudor Ambarus, Michael Walle,
	Richard Weinberger, Vignesh Raghavendra, linux-mtd, linux-kernel,
	kernel-janitors

Hello,

On 06/02/2026 at 15:14:46 +01, Pratyush Yadav <pratyush@kernel.org> wrote:

> On Fri, Feb 06 2026, Dan Carpenter wrote:
>
>> This was converted to a _scoped() loop but this of_node_put() was
>> accidentally left behind which is a double free.
>>
>> Fixes: aa8cb72c2018 ("mtd: spi-nor: hisi-sfc: Simplify with scoped for each OF child loop")
>> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
>
> Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
>
> Miquel, since you took the original patch through the NAND tree, can you
> please take this one too?

Yes I will, thanks!

Miquèl

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH next] mtd: spi-nor: hisi-sfc: fix refcounting bug in hisi_spi_nor_register_all()
  2026-02-06 13:38 ` [PATCH next] mtd: spi-nor: hisi-sfc: fix refcounting bug in hisi_spi_nor_register_all() Dan Carpenter
  2026-02-06 14:14   ` Pratyush Yadav
@ 2026-02-06 14:23   ` Miquel Raynal
  1 sibling, 0 replies; 4+ messages in thread
From: Miquel Raynal @ 2026-02-06 14:23 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Dan Carpenter
  Cc: Tudor Ambarus, Pratyush Yadav, Michael Walle, Richard Weinberger,
	Vignesh Raghavendra, linux-mtd, linux-kernel, kernel-janitors

On Fri, 06 Feb 2026 16:38:54 +0300, Dan Carpenter wrote:
> This was converted to a _scoped() loop but this of_node_put() was
> accidentally left behind which is a double free.
> 
> 

Applied to nand/next, thanks!

[1/1] mtd: spi-nor: hisi-sfc: fix refcounting bug in hisi_spi_nor_register_all()
      commit: 6c7860aa28b81b7e909b8d2072ed76fa22db6eda

Patche(s) should be available on mtd/linux.git and will be
part of the next PR (provided that no robot complains by then).

Kind regards,
Miquèl


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-02-06 14:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <caa37f28-a2e8-4e0a-a9ce-a365ce805e4b@stanley.mountain>
2026-02-06 13:38 ` [PATCH next] mtd: spi-nor: hisi-sfc: fix refcounting bug in hisi_spi_nor_register_all() Dan Carpenter
2026-02-06 14:14   ` Pratyush Yadav
2026-02-06 14:22     ` Miquel Raynal
2026-02-06 14:23   ` Miquel Raynal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox