dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/meson: Fix refcount bugs in meson_vpu_has_available_connectors()
@ 2022-07-15 13:21 Liang He
  2022-07-25 19:39 ` Martin Blumenstingl
  0 siblings, 1 reply; 3+ messages in thread
From: Liang He @ 2022-07-15 13:21 UTC (permalink / raw)
  To: narmstrong, airlied, daniel, khilman, windhl, jbrunet,
	martin.blumenstingl, dri-devel

In this function, there are two refcount leak bugs:
(1) when breaking out of for_each_endpoint_of_node(), we need call
the of_node_put() for the 'ep';
(2) we should call of_node_put() for the reference returned by
of_graph_get_remote_port() when it is not used anymore.

Fixes: bbbe775ec5b5 ("drm: Add support for Amlogic Meson Graphic Controller")
Signed-off-by: Liang He <windhl@126.com>
---
 drivers/gpu/drm/meson/meson_drv.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
index 1b70938cfd2c..bd4ca11d3ff5 100644
--- a/drivers/gpu/drm/meson/meson_drv.c
+++ b/drivers/gpu/drm/meson/meson_drv.c
@@ -115,8 +115,11 @@ static bool meson_vpu_has_available_connectors(struct device *dev)
 	for_each_endpoint_of_node(dev->of_node, ep) {
 		/* If the endpoint node exists, consider it enabled */
 		remote = of_graph_get_remote_port(ep);
-		if (remote)
+		if (remote) {
+			of_node_put(remote);
+			of_node_put(ep);
 			return true;
+		}
 	}
 
 	return false;
-- 
2.25.1


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

* Re: [PATCH] drm/meson: Fix refcount bugs in meson_vpu_has_available_connectors()
  2022-07-15 13:21 [PATCH] drm/meson: Fix refcount bugs in meson_vpu_has_available_connectors() Liang He
@ 2022-07-25 19:39 ` Martin Blumenstingl
  2022-07-26  0:59   ` Liang He
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Blumenstingl @ 2022-07-25 19:39 UTC (permalink / raw)
  To: Liang He; +Cc: Neil Armstrong, airlied, khilman, dri-devel, jbrunet

Hello,

On Fri, Jul 15, 2022 at 3:22 PM Liang He <windhl@126.com> wrote:
>
> In this function, there are two refcount leak bugs:
> (1) when breaking out of for_each_endpoint_of_node(), we need call
> the of_node_put() for the 'ep';
> (2) we should call of_node_put() for the reference returned by
> of_graph_get_remote_port() when it is not used anymore.
>
> Fixes: bbbe775ec5b5 ("drm: Add support for Amlogic Meson Graphic Controller")
> Signed-off-by: Liang He <windhl@126.com>
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

It's easy for me to miss patches if the linux-amlogic list is not part
of the recipient list.
Can you please re-send this patch and include the linux-amlogic
mailing list (with my acked-by added)? Then it should also show up in
Neil's inbox so he can apply this patch.


Thank you
Martin

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

* Re:Re: [PATCH] drm/meson: Fix refcount bugs in meson_vpu_has_available_connectors()
  2022-07-25 19:39 ` Martin Blumenstingl
@ 2022-07-26  0:59   ` Liang He
  0 siblings, 0 replies; 3+ messages in thread
From: Liang He @ 2022-07-26  0:59 UTC (permalink / raw)
  To: Martin Blumenstingl; +Cc: Neil Armstrong, airlied, khilman, dri-devel, jbrunet


At 2022-07-26 03:39:17, "Martin Blumenstingl" <martin.blumenstingl@googlemail.com> wrote:
>Hello,
>
>On Fri, Jul 15, 2022 at 3:22 PM Liang He <windhl@126.com> wrote:
>>
>> In this function, there are two refcount leak bugs:
>> (1) when breaking out of for_each_endpoint_of_node(), we need call
>> the of_node_put() for the 'ep';
>> (2) we should call of_node_put() for the reference returned by
>> of_graph_get_remote_port() when it is not used anymore.
>>
>> Fixes: bbbe775ec5b5 ("drm: Add support for Amlogic Meson Graphic Controller")
>> Signed-off-by: Liang He <windhl@126.com>
>Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
>
>It's easy for me to miss patches if the linux-amlogic list is not part
>of the recipient list.
>Can you please re-send this patch and include the linux-amlogic
>mailing list (with my acked-by added)? Then it should also show up in
>Neil's inbox so he can apply this patch.
>
>
>Thank you
>Martin

Thanks, 

I will do that soon.

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

end of thread, other threads:[~2022-07-26  1:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-15 13:21 [PATCH] drm/meson: Fix refcount bugs in meson_vpu_has_available_connectors() Liang He
2022-07-25 19:39 ` Martin Blumenstingl
2022-07-26  0:59   ` Liang He

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).