]> git.hungrycats.org Git - linux/commitdiff
powerpc/warp: Fix error handling in pika_dtm_thread
authorMa Ke <make24@iscas.ac.cn>
Sun, 16 Nov 2025 02:44:11 +0000 (10:44 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Jun 2026 15:29:48 +0000 (17:29 +0200)
commit 108d7f951271cbd36ca36efc5e5d106966f5180c upstream.

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>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20251116024411.21968-1-make24@iscas.ac.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/platforms/44x/warp.c

index 665f18e37efb29be65cc7d84498c55dfcf0d634a..3d1398125507b5c11a61740c2a87d12e9490c4fb 100644 (file)
@@ -261,6 +261,8 @@ static int pika_dtm_thread(void __iomem *fpga)
                schedule_timeout(HZ);
        }
 
+       put_device(&client->dev);
+
        return 0;
 }