The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] media: v4l2-core: Fix memory leak in v4l2_fwnode_parse_link
@ 2026-06-16 13:46 Biren Pandya
  0 siblings, 0 replies; 2+ messages in thread
From: Biren Pandya @ 2026-06-16 13:46 UTC (permalink / raw)
  To: sakari.ailus, mchehab; +Cc: linux-media, linux-kernel, Biren Pandya

In v4l2_fwnode_parse_link(), the remote endpoint fwnode reference is
acquired using fwnode_graph_get_remote_endpoint(). This reference is
properly released in the error paths, but it is leaked on the success
path.

Add the missing fwnode_handle_put() before returning 0 to prevent the
reference leak.

Signed-off-by: Biren Pandya <birenpandya@gmail.com>
---
 drivers/media/v4l2-core/v4l2-fwnode.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c
index 77f3298821b5..93ef83c591ef 100644
--- a/drivers/media/v4l2-core/v4l2-fwnode.c
+++ b/drivers/media/v4l2-core/v4l2-fwnode.c
@@ -633,6 +633,7 @@ int v4l2_fwnode_parse_link(struct fwnode_handle *fwnode,
 	if (!link->remote_node)
 		goto err_put_remote_endpoint;
 
+	fwnode_handle_put(fwnode);
 	return 0;
 
 err_put_remote_endpoint:
-- 
2.50.1 (Apple Git-155)


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

* [PATCH] media: v4l2-core: Fix memory leak in v4l2_fwnode_parse_link
@ 2026-07-08 15:20 Biren Pandya
  0 siblings, 0 replies; 2+ messages in thread
From: Biren Pandya @ 2026-07-08 15:20 UTC (permalink / raw)
  To: sakari.ailus, mchehab, linux-media, linux-kernel; +Cc: Biren Pandya, stable

In v4l2_fwnode_parse_link(), the remote endpoint fwnode reference is
acquired using fwnode_graph_get_remote_endpoint(). This reference is
properly released in the error paths, but it is leaked on the success
path. Add the missing fwnode_handle_put() before returning 0 to prevent
the reference leak.

Fixes: ca50c197bd96 ("[media] v4l: fwnode: Support generic fwnode for parsing standardised properties")
Cc: stable@vger.kernel.org
Signed-off-by: Biren Pandya <birenpandya@gmail.com>
---
 drivers/media/v4l2-core/v4l2-fwnode.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c
index 77f3298821b5c..93ef83c591ef2 100644
--- a/drivers/media/v4l2-core/v4l2-fwnode.c
+++ b/drivers/media/v4l2-core/v4l2-fwnode.c
@@ -633,6 +633,7 @@ int v4l2_fwnode_parse_link(struct fwnode_handle *fwnode,
 	if (!link->remote_node)
 		goto err_put_remote_endpoint;
 
+	fwnode_handle_put(fwnode);
 	return 0;
 
 err_put_remote_endpoint:
-- 
2.50.1 (Apple Git-155)


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

end of thread, other threads:[~2026-07-08 15:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-08 15:20 [PATCH] media: v4l2-core: Fix memory leak in v4l2_fwnode_parse_link Biren Pandya
  -- strict thread matches above, loose matches on Subject: below --
2026-06-16 13:46 Biren Pandya

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