* [PATCH] powerpc/warp: Fix error handling in pika_dtm_thread
@ 2025-11-16 2:44 Ma Ke
2025-11-19 15:37 ` Christophe Leroy
2026-05-18 5:43 ` Madhavan Srinivasan
0 siblings, 2 replies; 3+ messages in thread
From: Ma Ke @ 2025-11-16 2:44 UTC (permalink / raw)
To: maddy, mpe, npiggin, christophe.leroy, make24, benh, smaclennan
Cc: linuxppc-dev, linux-kernel, akpm, stable
pika_dtm_thread() acquires client through of_find_i2c_device_by_node()
but fails to release it in error handling path. This could result in a
reference count leak, preventing proper cleanup and potentially
leading to resource exhaustion. Add put_device() to release the
reference in the error handling path.
Found by code review.
Cc: stable@vger.kernel.org
Fixes: 3984114f0562 ("powerpc/warp: Platform fix for i2c change")
Signed-off-by: Ma Ke <make24@iscas.ac.cn>
---
arch/powerpc/platforms/44x/warp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/powerpc/platforms/44x/warp.c b/arch/powerpc/platforms/44x/warp.c
index a5001d32f978..6f674f86dc85 100644
--- a/arch/powerpc/platforms/44x/warp.c
+++ b/arch/powerpc/platforms/44x/warp.c
@@ -293,6 +293,8 @@ static int pika_dtm_thread(void __iomem *fpga)
schedule_timeout(HZ);
}
+ put_device(&client->dev);
+
return 0;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc/warp: Fix error handling in pika_dtm_thread
2025-11-16 2:44 [PATCH] powerpc/warp: Fix error handling in pika_dtm_thread Ma Ke
@ 2025-11-19 15:37 ` Christophe Leroy
2026-05-18 5:43 ` Madhavan Srinivasan
1 sibling, 0 replies; 3+ messages in thread
From: Christophe Leroy @ 2025-11-19 15:37 UTC (permalink / raw)
To: Ma Ke, maddy, mpe, npiggin, benh, smaclennan
Cc: linuxppc-dev, linux-kernel, akpm, stable
Le 16/11/2025 à 03:44, Ma Ke a écrit :
> ***ATTENTION, Sopra Steria Group cannot confirm the identity of this email sender (SPF record failure). This might be a fake email from an attacker, if you have any doubts report and delete the email.***
>
> ***ATTENTION, Sopra Steria Group ne peut pas confirmer l’identité de l’émetteur de ce message (SPF record failure). Il pourrait s’agir d’un faux message, à détruire si vous avez un doute ***
>
> pika_dtm_thread() acquires client through of_find_i2c_device_by_node()
> but fails to release it in error handling path. This could result in a
> reference count leak, preventing proper cleanup and potentially
> leading to resource exhaustion. Add put_device() to release the
> reference in the error handling path.
It is not really an error path, it is the termination of the kthread.
>
> Found by code review.
>
> Cc: stable@vger.kernel.org
> Fixes: 3984114f0562 ("powerpc/warp: Platform fix for i2c change")
> Signed-off-by: Ma Ke <make24@iscas.ac.cn>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
> arch/powerpc/platforms/44x/warp.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/powerpc/platforms/44x/warp.c b/arch/powerpc/platforms/44x/warp.c
> index a5001d32f978..6f674f86dc85 100644
> --- a/arch/powerpc/platforms/44x/warp.c
> +++ b/arch/powerpc/platforms/44x/warp.c
> @@ -293,6 +293,8 @@ static int pika_dtm_thread(void __iomem *fpga)
> schedule_timeout(HZ);
> }
>
> + put_device(&client->dev);
> +
> return 0;
> }
>
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc/warp: Fix error handling in pika_dtm_thread
2025-11-16 2:44 [PATCH] powerpc/warp: Fix error handling in pika_dtm_thread Ma Ke
2025-11-19 15:37 ` Christophe Leroy
@ 2026-05-18 5:43 ` Madhavan Srinivasan
1 sibling, 0 replies; 3+ messages in thread
From: Madhavan Srinivasan @ 2026-05-18 5:43 UTC (permalink / raw)
To: mpe, npiggin, benh, smaclennan, Christophe Leroy, Ma Ke
Cc: linuxppc-dev, linux-kernel, akpm, stable
On Sun, 16 Nov 2025 10:44:11 +0800, Ma Ke wrote:
> pika_dtm_thread() acquires client through of_find_i2c_device_by_node()
> but fails to release it in error handling path. This could result in a
> reference count leak, preventing proper cleanup and potentially
> leading to resource exhaustion. Add put_device() to release the
> reference in the error handling path.
>
> Found by code review.
>
> [...]
Applied to powerpc/fixes.
[1/1] powerpc/warp: Fix error handling in pika_dtm_thread
https://git.kernel.org/powerpc/c/108d7f951271cbd36ca36efc5e5d106966f5180c
cheers
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-05-18 5:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-16 2:44 [PATCH] powerpc/warp: Fix error handling in pika_dtm_thread Ma Ke
2025-11-19 15:37 ` Christophe Leroy
2026-05-18 5:43 ` Madhavan Srinivasan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox