mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mtd: rawnand: intel: fix OF node reference leak
@ 2026-09-15 16:34 Guangshuo Li
  2026-09-20 13:22 ` Miquel Raynal
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Guangshuo Li @ 2026-09-15 16:34 UTC (permalink / raw)
  To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Guangshuo Li, Martin Blumenstingl, linux-mtd, linux-kernel
  Cc: stable

ebu_nand_probe() gets a reference to the NAND chip node with
of_get_next_child(). The probe failure paths release the reference with
of_node_put(), but the successful probe path keeps it for the lifetime
of the device and ebu_nand_remove() never drops it.

As a result, each bind/unbind cycle leaks a reference to the NAND chip
device node.

Drop the reference in ebu_nand_remove() after the NAND teardown using
the flash node stored in the NAND chip.

This issue was found by manual code inspection.

Fixes: bfc618fcc3f1 ("mtd: rawnand: intel: Read the chip-select line from the correct OF node")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
 drivers/mtd/nand/raw/intel-nand-controller.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mtd/nand/raw/intel-nand-controller.c b/drivers/mtd/nand/raw/intel-nand-controller.c
index 01cefdaf115d..9f3e3a6cec71 100644
--- a/drivers/mtd/nand/raw/intel-nand-controller.c
+++ b/drivers/mtd/nand/raw/intel-nand-controller.c
@@ -711,6 +711,7 @@ static int ebu_nand_probe(struct platform_device *pdev)
 static void ebu_nand_remove(struct platform_device *pdev)
 {
 	struct ebu_nand_controller *ebu_host = platform_get_drvdata(pdev);
+	struct device_node *chip_np = nand_get_flash_node(&ebu_host->chip);
 	int ret;
 
 	ret = mtd_device_unregister(nand_to_mtd(&ebu_host->chip));
@@ -718,6 +719,7 @@ static void ebu_nand_remove(struct platform_device *pdev)
 	nand_cleanup(&ebu_host->chip);
 	ebu_nand_disable(&ebu_host->chip);
 	ebu_dma_cleanup(ebu_host);
+	of_node_put(chip_np);
 }
 
 static const struct of_device_id ebu_nand_match[] = {
-- 
2.43.0


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

* Re: [PATCH] mtd: rawnand: intel: fix OF node reference leak
  2026-09-15 16:34 [PATCH] mtd: rawnand: intel: fix OF node reference leak Guangshuo Li
@ 2026-09-20 13:22 ` Miquel Raynal
  2026-09-21 15:11 ` krzk
  2026-09-21 15:13 ` krzk
  2 siblings, 0 replies; 5+ messages in thread
From: Miquel Raynal @ 2026-09-20 13:22 UTC (permalink / raw)
  To: Guangshuo Li
  Cc: Richard Weinberger, Vignesh Raghavendra, Martin Blumenstingl,
	linux-mtd, linux-kernel, stable

On 16/09/2026 at 00:34:07 +08, Guangshuo Li <lgs201920130244@gmail.com> wrote:

> ebu_nand_probe() gets a reference to the NAND chip node with
> of_get_next_child(). The probe failure paths release the reference with
> of_node_put(), but the successful probe path keeps it for the lifetime
> of the device and ebu_nand_remove() never drops it.
>
> As a result, each bind/unbind cycle leaks a reference to the NAND chip
> device node.
>
> Drop the reference in ebu_nand_remove() after the NAND teardown using
> the flash node stored in the NAND chip.
>
> This issue was found by manual code inspection.

Feels like what you say is not what you do. Please align the code or the
commit log with your real intention.

> Fixes: bfc618fcc3f1 ("mtd: rawnand: intel: Read the chip-select line from the correct OF node")
> Cc: stable@vger.kernel.org
> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>

Thanks,
Miquèl

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

* Re: [PATCH] mtd: rawnand: intel: fix OF node reference leak
  2026-09-15 16:34 [PATCH] mtd: rawnand: intel: fix OF node reference leak Guangshuo Li
  2026-09-20 13:22 ` Miquel Raynal
@ 2026-09-21 15:11 ` krzk
  2026-09-22  2:51   ` Guangshuo Li
  2026-09-21 15:13 ` krzk
  2 siblings, 1 reply; 5+ messages in thread
From: krzk @ 2026-09-21 15:11 UTC (permalink / raw)
  To: Guangshuo Li
  Cc: Miquel Raynal, stable, Vignesh Raghavendra, linux-mtd,
	linux-kernel, Martin Blumenstingl, Richard Weinberger


On Wed, 16 Sep 2026 00:34:07 +0800, Guangshuo Li wrote:
> ebu_nand_probe() gets a reference to the NAND chip node with
> of_get_next_child(). The probe failure paths release the reference with
> of_node_put(), but the successful probe path keeps it for the lifetime
> of the device and ebu_nand_remove() never drops it.
> 
> As a result, each bind/unbind cycle leaks a reference to the NAND chip
> device node.
> 
> Drop the reference in ebu_nand_remove() after the NAND teardown using
> the flash node stored in the NAND chip.
> 
> This issue was found by manual code inspection.
> 
> Fixes: bfc618fcc3f1 ("mtd: rawnand: intel: Read the chip-select line from the correct OF node")
> Cc: stable@vger.kernel.org
> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
> ---
>  drivers/mtd/nand/raw/intel-nand-controller.c | 2 ++
>  1 file changed, 2 insertions(+)
> 


You sent multiple independent patches, to multiple independent
subsystems. The amount of these patches clearly suggest this was
AI generated and most likely not tested.

More importantly, you sent all this work without properly organizing
relevant patches into patchsets. This makes reviewing difficult
and might cause multiple reviewers to address the same issue.
Replying to the entire set is impossible and requires handling each
patch independently, instead of applying or discarding the set.
Maintainers also won't see the bigger picture of your work. Quite
worrying.

This is on the verge of hostile patch: bomb us with so many
contributions, we won't be able to handle them in efficient manner,
like responding ONCE to ask you to slow down.  Considering all this
is untested and LLM generated, I have even more doubts whether this
should be considered for review.

Please read kernel documentation BEFORE posting more work. It will
explain you how to identify subsystems, how to organize your work per
subsystem, how to document usage of LLM and how what you should not
do if this was posted in a good faith.

Best regards,
Krzysztof




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

* Re: [PATCH] mtd: rawnand: intel: fix OF node reference leak
  2026-09-15 16:34 [PATCH] mtd: rawnand: intel: fix OF node reference leak Guangshuo Li
  2026-09-20 13:22 ` Miquel Raynal
  2026-09-21 15:11 ` krzk
@ 2026-09-21 15:13 ` krzk
  2 siblings, 0 replies; 5+ messages in thread
From: krzk @ 2026-09-21 15:13 UTC (permalink / raw)
  To: Guangshuo Li
  Cc: Vignesh Raghavendra, stable, Miquel Raynal, Richard Weinberger,
	Martin Blumenstingl, linux-mtd, linux-kernel


On Wed, 16 Sep 2026 00:34:07 +0800, Guangshuo Li wrote:
> ebu_nand_probe() gets a reference to the NAND chip node with
> of_get_next_child(). The probe failure paths release the reference with
> of_node_put(), but the successful probe path keeps it for the lifetime
> of the device and ebu_nand_remove() never drops it.
> 
> As a result, each bind/unbind cycle leaks a reference to the NAND chip
> device node.
> 
> Drop the reference in ebu_nand_remove() after the NAND teardown using
> the flash node stored in the NAND chip.
> 
> This issue was found by manual code inspection.
> 
> Fixes: bfc618fcc3f1 ("mtd: rawnand: intel: Read the chip-select line from the correct OF node")
> Cc: stable@vger.kernel.org
> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
> ---
>  drivers/mtd/nand/raw/intel-nand-controller.c | 2 ++
>  1 file changed, 2 insertions(+)
> 


You sent multiple independent patches, to multiple independent
subsystems. The amount of these patches clearly suggest this was
AI generated and most likely not tested.

More importantly, you sent all this work without properly organizing
relevant patches into patchsets. This makes reviewing difficult
and might cause multiple reviewers to address the same issue.
Replying to the entire set is impossible and requires handling each
patch independently, instead of applying or discarding the set.
Maintainers also won't see the bigger picture of your work. Quite
worrying.

This is on the verge of hostile patch: bomb us with so many
contributions, we won't be able to handle them in efficient manner,
like responding ONCE to ask you to slow down.  Considering all this
is untested and LLM generated, I have even more doubts whether this
should be considered for review.

Please read kernel documentation BEFORE posting more work. It will
explain you how to identify subsystems, how to organize your work per
subsystem, how to document usage of LLM and how what you should not
do if this was posted in a good faith.

Best regards,
Krzysztof




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

* Re: [PATCH] mtd: rawnand: intel: fix OF node reference leak
  2026-09-21 15:11 ` krzk
@ 2026-09-22  2:51   ` Guangshuo Li
  0 siblings, 0 replies; 5+ messages in thread
From: Guangshuo Li @ 2026-09-22  2:51 UTC (permalink / raw)
  To: krzk
  Cc: Miquel Raynal, stable, Vignesh Raghavendra, linux-mtd,
	linux-kernel, Martin Blumenstingl, Richard Weinberger

Hi Krzysztof,

Thank you for your feedback.

On Mon, 21 Sept 2026 at 23:11, <krzk@kernel.org> wrote:
>
>
> On Wed, 16 Sep 2026 00:34:07 +0800, Guangshuo Li wrote:
> > ebu_nand_probe() gets a reference to the NAND chip node with
> > of_get_next_child(). The probe failure paths release the reference with
> > of_node_put(), but the successful probe path keeps it for the lifetime
> > of the device and ebu_nand_remove() never drops it.
> >
> > As a result, each bind/unbind cycle leaks a reference to the NAND chip
> > device node.
> >
> > Drop the reference in ebu_nand_remove() after the NAND teardown using
> > the flash node stored in the NAND chip.
> >
> > This issue was found by manual code inspection.
> >
> > Fixes: bfc618fcc3f1 ("mtd: rawnand: intel: Read the chip-select line from the correct OF node")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
> > ---
> >  drivers/mtd/nand/raw/intel-nand-controller.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
>
>
> You sent multiple independent patches, to multiple independent
> subsystems. The amount of these patches clearly suggest this was
> AI generated and most likely not tested.
>
> More importantly, you sent all this work without properly organizing
> relevant patches into patchsets. This makes reviewing difficult
> and might cause multiple reviewers to address the same issue.
> Replying to the entire set is impossible and requires handling each
> patch independently, instead of applying or discarding the set.
> Maintainers also won't see the bigger picture of your work. Quite
> worrying.
>
> This is on the verge of hostile patch: bomb us with so many
> contributions, we won't be able to handle them in efficient manner,
> like responding ONCE to ask you to slow down.  Considering all this
> is untested and LLM generated, I have even more doubts whether this
> should be considered for review.
>
> Please read kernel documentation BEFORE posting more work. It will
> explain you how to identify subsystems, how to organize your work per
> subsystem, how to document usage of LLM and how what you should not
> do if this was posted in a good faith.
>
> Best regards,
> Krzysztof
>
>
>

I would like to clarify that these patches were manually reviewed and
audited by us; they were not simply generated and submitted by an LLM.
However, I understand why the recent submission pattern may have given
that impression. We sent too many patches in a short period of time,
and we also failed to respond to some discussions in a timely manner,
which made the situation look worse.

Many of the recent patches, especially the v2 revisions, are
corrections and improvements based on previous review feedback rather
than completely new untested changes. That said, we recognize that the
way we submitted them increased the burden on maintainers and
reviewers.

We apologize for the pressure this caused to the community. We will be
more careful about organizing patches by subsystem, preparing proper
patchsets, and following the kernel contribution guidelines before
sending future work.

Thank you again for pointing this out.

Best regards,
Guangshuo

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

end of thread, other threads:[~2026-09-22  2:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-15 16:34 [PATCH] mtd: rawnand: intel: fix OF node reference leak Guangshuo Li
2026-09-20 13:22 ` Miquel Raynal
2026-09-21 15:11 ` krzk
2026-09-22  2:51   ` Guangshuo Li
2026-09-21 15:13 ` krzk

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®