[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 4 Apr 2019 16:35:24 +0300
From: Laurent Pinchart <laurent.pinchart@...asonboard.com>
To: Wen Yang <wen.yang99@....com.cn>
Cc: linux-kernel@...r.kernel.org, wang.yi59@....com.cn,
Kieran Bingham <kieran.bingham+renesas@...asonboard.com>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
dri-devel@...ts.freedesktop.org, linux-renesas-soc@...r.kernel.org
Subject: Re: [PATCH 6/7] drm: rcar-du: fix possible object reference leak
Hi Wen,
Thank you for the patch.
On Thu, Apr 04, 2019 at 12:04:14AM +0800, Wen Yang wrote:
> The call to of_get_parent returns a node pointer with refcount
> incremented thus it must be explicitly decremented after the last
> usage.
>
> Detected by coccinelle with the following warnings:
> drivers/gpu/drm/rcar-du/rcar_du_of.c:235:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 216, but without a corresponding object release within this function.
> drivers/gpu/drm/rcar-du/rcar_du_of.c:236:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 209, but without a corresponding object release within this function.
>
> Signed-off-by: Wen Yang <wen.yang99@....com.cn>
> Cc: Laurent Pinchart <laurent.pinchart@...asonboard.com>
> Cc: Kieran Bingham <kieran.bingham+renesas@...asonboard.com>
> Cc: David Airlie <airlied@...ux.ie>
> Cc: Daniel Vetter <daniel@...ll.ch>
> Cc: dri-devel@...ts.freedesktop.org
> Cc: linux-renesas-soc@...r.kernel.org
> Cc: linux-kernel@...r.kernel.org (open list)
> ---
> drivers/gpu/drm/rcar-du/rcar_du_of.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_of.c b/drivers/gpu/drm/rcar-du/rcar_du_of.c
> index afef696..30bceca 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_of.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_of.c
> @@ -232,6 +232,8 @@ static void __init rcar_du_of_lvds_patch(const struct of_device_id *of_ids)
> lvds_node = of_find_compatible_node(NULL, NULL, compatible);
> if (lvds_node) {
> of_node_put(lvds_node);
> + of_node_put(soc_node);
> + of_node_put(du_node);
> return;
Wouldn't it be simpler to just turn the return into a goto done ?
> }
>
--
Regards,
Laurent Pinchart
Powered by blists - more mailing lists