mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] media: v4l2-core: Fix a potential resource leak in v4l2_fwnode_parse_link()
@ 2023-05-29  6:17 Christophe JAILLET
  2023-06-13 10:55 ` Sakari Ailus
  0 siblings, 1 reply; 4+ messages in thread
From: Christophe JAILLET @ 2023-05-29  6:17 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Sakari Ailus
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-media

'fwnode is known to be NULL, at this point, so fwnode_handle_put() is a
no-op.

Release the reference taken from a previous fwnode_graph_get_port_parent()
call instead.

Fixes: ca50c197bd96 ("[media] v4l: fwnode: Support generic fwnode for parsing standardised properties")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
/!\  THIS PATCH IS SPECULATIVE  /!\
         review with care
---
 drivers/media/v4l2-core/v4l2-fwnode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c
index 049c2f2001ea..b7dd467c53fd 100644
--- a/drivers/media/v4l2-core/v4l2-fwnode.c
+++ b/drivers/media/v4l2-core/v4l2-fwnode.c
@@ -571,7 +571,7 @@ int v4l2_fwnode_parse_link(struct fwnode_handle *fwnode,
 
 	fwnode = fwnode_graph_get_remote_endpoint(fwnode);
 	if (!fwnode) {
-		fwnode_handle_put(fwnode);
+		fwnode_handle_put(link->local_node);
 		return -ENOLINK;
 	}
 
-- 
2.34.1


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

end of thread, other threads:[~2023-06-14  8:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-29  6:17 [PATCH] media: v4l2-core: Fix a potential resource leak in v4l2_fwnode_parse_link() Christophe JAILLET
2023-06-13 10:55 ` Sakari Ailus
2023-06-13 17:15   ` Christophe JAILLET
2023-06-14  8:00     ` Sakari Ailus

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®