From: JeffyChen <jeffy.chen@rock-chips.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Enric Balletbo i Serra <enric.balletbo@collabora.com>
Cc: Jose Abreu <Jose.Abreu@synopsys.com>,
Jernej Skrabec <jernej.skrabec@siol.net>,
linux-rockchip@lists.infradead.org,
David Airlie <airlied@linux.ie>,
Daniel Vetter <daniel.vetter@ffwll.ch>,
Neil Armstrong <narmstrong@baylibre.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
Hans Verkuil <hverkuil@xs4all.nl>,
Russell King <rmk+kernel@armlinux.org.uk>,
kernel@collabora.com, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v9 5/5] drm/bridge/synopsys: dw-hdmi: Add missing bridge detach
Date: Mon, 05 Mar 2018 15:01:24 +0800 [thread overview]
Message-ID: <5A9CEB44.40207@rock-chips.com> (raw)
In-Reply-To: <5A99EA37.6070006@rock-chips.com>
Hi Laurent,
sorry, you're right, this patch should not be needed.
the connector should be cleanup by
drm_mode_config_cleanup->drm_connector_put.
i did that in analogix_dp is to avoid a use-after-free issue not
kmemleak, because the connector was allocated/freed in analogix_dp's
bind/unbind.
but i found a kmemleak issue(dma_mask not freed) in dw-hdmi when testing
that, will send patch soon.
On 03/03/2018 08:20 AM, JeffyChen wrote:
> Hi Laurent,
>
> On 03/03/2018 05:49 AM, Laurent Pinchart wrote:
>> Hi Enric,
>>
>> Thank you for the patch.
>>
>> On Friday, 2 March 2018 19:57:57 EET Enric Balletbo i Serra wrote:
>>> From: Jeffy Chen <jeffy.chen@rock-chips.com>
>>>
>>> We inited connector in attach(), so need a detach() to cleanup.
>>
>> Do we ? The dw-hdmi driver already sets drm_connector_cleanup() as the
>> connector .destroy() handler, and the .destroy() operation is called
>> by the
>> DRM core. None of the other bridge drivers call drm_connector_cleanup()
>> directly.
>
> hmmm, checking the code, there are also lots of drivers do the
> cleanup(drm_connector_cleanup or funcs->destroy):
> drm# grep -r "connector.*funcs->destroy" .
> ./rockchip/inno_hdmi.c: hdmi->connector.funcs->destroy(&hdmi->connector);
> ./rockchip/cdn-dp-core.c: connector->funcs->destroy(connector);
> ./bridge/analogix/analogix_dp_core.c:
> dp->connector.funcs->destroy(&dp->connector);
> ./msm/hdmi/hdmi.c: hdmi->connector->funcs->destroy(hdmi->connector);
> ./msm/dsi/dsi.c: msm_dsi->connector->funcs->destroy(msm_dsi->connector);
> ./msm/edp/edp.c: edp->connector->funcs->destroy(edp->connector);
> ./zte/zx_hdmi.c: hdmi->connector.funcs->destroy(&hdmi->connector);
> ./drm_connector.c: connector->funcs->destroy(connector);
> ./drm_connector.c: connector->funcs->destroy(connector);
> ./nouveau/dispnv04/disp.c: connector->funcs->destroy(connector);
> ./nouveau/nv50_display.c: mstc->connector.funcs->destroy(&mstc->connector);
> ./nouveau/nv50_display.c: connector->funcs->destroy(connector);
>
>
>
> when i debug analogix_dp bind/unbind, i found that we need to cleanup
> the connector(reported by kmemleak). so i added it to
> ./bridge/analogix/analogix_dp_core.c...after that i saw dw-hdmi missing
> that too(by checking the code), so make this patch.
>
> but i didn't really tested it on devices using dw-hdmi, so i'm not very
> sure the dw-hdmi(maybe also other bridges) is the same with analogix_dp.
>
> i can try to find a chromebook veyron to check it next week :)
>
> but even there's a leak, i'm still not very sure about:
> should the caller of drm_connector_init cleanup it
> or the caller of drm_bridge_attach should do it(for example
> analogix_dp_bind/analogix_dp_unbind)
> or should the DRM core take care of that?
>
>>
>>> Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
>>> Signed-off-by: Thierry Escande <thierry.escande@collabora.com>
>>> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
>>> ---
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: jeffy.chen@rock-chips.com (JeffyChen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v9 5/5] drm/bridge/synopsys: dw-hdmi: Add missing bridge detach
Date: Mon, 05 Mar 2018 15:01:24 +0800 [thread overview]
Message-ID: <5A9CEB44.40207@rock-chips.com> (raw)
In-Reply-To: <5A99EA37.6070006@rock-chips.com>
Hi Laurent,
sorry, you're right, this patch should not be needed.
the connector should be cleanup by
drm_mode_config_cleanup->drm_connector_put.
i did that in analogix_dp is to avoid a use-after-free issue not
kmemleak, because the connector was allocated/freed in analogix_dp's
bind/unbind.
but i found a kmemleak issue(dma_mask not freed) in dw-hdmi when testing
that, will send patch soon.
On 03/03/2018 08:20 AM, JeffyChen wrote:
> Hi Laurent,
>
> On 03/03/2018 05:49 AM, Laurent Pinchart wrote:
>> Hi Enric,
>>
>> Thank you for the patch.
>>
>> On Friday, 2 March 2018 19:57:57 EET Enric Balletbo i Serra wrote:
>>> From: Jeffy Chen <jeffy.chen@rock-chips.com>
>>>
>>> We inited connector in attach(), so need a detach() to cleanup.
>>
>> Do we ? The dw-hdmi driver already sets drm_connector_cleanup() as the
>> connector .destroy() handler, and the .destroy() operation is called
>> by the
>> DRM core. None of the other bridge drivers call drm_connector_cleanup()
>> directly.
>
> hmmm, checking the code, there are also lots of drivers do the
> cleanup(drm_connector_cleanup or funcs->destroy):
> drm# grep -r "connector.*funcs->destroy" .
> ./rockchip/inno_hdmi.c: hdmi->connector.funcs->destroy(&hdmi->connector);
> ./rockchip/cdn-dp-core.c: connector->funcs->destroy(connector);
> ./bridge/analogix/analogix_dp_core.c:
> dp->connector.funcs->destroy(&dp->connector);
> ./msm/hdmi/hdmi.c: hdmi->connector->funcs->destroy(hdmi->connector);
> ./msm/dsi/dsi.c: msm_dsi->connector->funcs->destroy(msm_dsi->connector);
> ./msm/edp/edp.c: edp->connector->funcs->destroy(edp->connector);
> ./zte/zx_hdmi.c: hdmi->connector.funcs->destroy(&hdmi->connector);
> ./drm_connector.c: connector->funcs->destroy(connector);
> ./drm_connector.c: connector->funcs->destroy(connector);
> ./nouveau/dispnv04/disp.c: connector->funcs->destroy(connector);
> ./nouveau/nv50_display.c: mstc->connector.funcs->destroy(&mstc->connector);
> ./nouveau/nv50_display.c: connector->funcs->destroy(connector);
>
>
>
> when i debug analogix_dp bind/unbind, i found that we need to cleanup
> the connector(reported by kmemleak). so i added it to
> ./bridge/analogix/analogix_dp_core.c...after that i saw dw-hdmi missing
> that too(by checking the code), so make this patch.
>
> but i didn't really tested it on devices using dw-hdmi, so i'm not very
> sure the dw-hdmi(maybe also other bridges) is the same with analogix_dp.
>
> i can try to find a chromebook veyron to check it next week :)
>
> but even there's a leak, i'm still not very sure about:
> should the caller of drm_connector_init cleanup it
> or the caller of drm_bridge_attach should do it(for example
> analogix_dp_bind/analogix_dp_unbind)
> or should the DRM core take care of that?
>
>>
>>> Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
>>> Signed-off-by: Thierry Escande <thierry.escande@collabora.com>
>>> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
>>> ---
WARNING: multiple messages have this Message-ID (diff)
From: JeffyChen <jeffy.chen@rock-chips.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Enric Balletbo i Serra <enric.balletbo@collabora.com>
Cc: "Sandy Huang" <hjc@rock-chips.com>,
"Heiko Stübner" <heiko@sntech.de>,
"Andrzej Hajda" <a.hajda@samsung.com>,
linux-rockchip@lists.infradead.org,
"Archit Taneja" <architt@codeaurora.org>,
linux-kernel@vger.kernel.org,
"Russell King" <rmk+kernel@armlinux.org.uk>,
"Neil Armstrong" <narmstrong@baylibre.com>,
dri-devel@lists.freedesktop.org,
"Jose Abreu" <Jose.Abreu@synopsys.com>,
"Hans Verkuil" <hverkuil@xs4all.nl>,
"Jernej Skrabec" <jernej.skrabec@siol.net>,
linux-arm-kernel@lists.infradead.org,
"David Airlie" <airlied@linux.ie>,
kernel@collabora.com, "Daniel Vetter" <daniel.vetter@ffwll.ch>,
"Sean Paul" <seanpaul@chromium.org>
Subject: Re: [PATCH v9 5/5] drm/bridge/synopsys: dw-hdmi: Add missing bridge detach
Date: Mon, 05 Mar 2018 15:01:24 +0800 [thread overview]
Message-ID: <5A9CEB44.40207@rock-chips.com> (raw)
In-Reply-To: <5A99EA37.6070006@rock-chips.com>
Hi Laurent,
sorry, you're right, this patch should not be needed.
the connector should be cleanup by
drm_mode_config_cleanup->drm_connector_put.
i did that in analogix_dp is to avoid a use-after-free issue not
kmemleak, because the connector was allocated/freed in analogix_dp's
bind/unbind.
but i found a kmemleak issue(dma_mask not freed) in dw-hdmi when testing
that, will send patch soon.
On 03/03/2018 08:20 AM, JeffyChen wrote:
> Hi Laurent,
>
> On 03/03/2018 05:49 AM, Laurent Pinchart wrote:
>> Hi Enric,
>>
>> Thank you for the patch.
>>
>> On Friday, 2 March 2018 19:57:57 EET Enric Balletbo i Serra wrote:
>>> From: Jeffy Chen <jeffy.chen@rock-chips.com>
>>>
>>> We inited connector in attach(), so need a detach() to cleanup.
>>
>> Do we ? The dw-hdmi driver already sets drm_connector_cleanup() as the
>> connector .destroy() handler, and the .destroy() operation is called
>> by the
>> DRM core. None of the other bridge drivers call drm_connector_cleanup()
>> directly.
>
> hmmm, checking the code, there are also lots of drivers do the
> cleanup(drm_connector_cleanup or funcs->destroy):
> drm# grep -r "connector.*funcs->destroy" .
> ./rockchip/inno_hdmi.c: hdmi->connector.funcs->destroy(&hdmi->connector);
> ./rockchip/cdn-dp-core.c: connector->funcs->destroy(connector);
> ./bridge/analogix/analogix_dp_core.c:
> dp->connector.funcs->destroy(&dp->connector);
> ./msm/hdmi/hdmi.c: hdmi->connector->funcs->destroy(hdmi->connector);
> ./msm/dsi/dsi.c: msm_dsi->connector->funcs->destroy(msm_dsi->connector);
> ./msm/edp/edp.c: edp->connector->funcs->destroy(edp->connector);
> ./zte/zx_hdmi.c: hdmi->connector.funcs->destroy(&hdmi->connector);
> ./drm_connector.c: connector->funcs->destroy(connector);
> ./drm_connector.c: connector->funcs->destroy(connector);
> ./nouveau/dispnv04/disp.c: connector->funcs->destroy(connector);
> ./nouveau/nv50_display.c: mstc->connector.funcs->destroy(&mstc->connector);
> ./nouveau/nv50_display.c: connector->funcs->destroy(connector);
>
>
>
> when i debug analogix_dp bind/unbind, i found that we need to cleanup
> the connector(reported by kmemleak). so i added it to
> ./bridge/analogix/analogix_dp_core.c...after that i saw dw-hdmi missing
> that too(by checking the code), so make this patch.
>
> but i didn't really tested it on devices using dw-hdmi, so i'm not very
> sure the dw-hdmi(maybe also other bridges) is the same with analogix_dp.
>
> i can try to find a chromebook veyron to check it next week :)
>
> but even there's a leak, i'm still not very sure about:
> should the caller of drm_connector_init cleanup it
> or the caller of drm_bridge_attach should do it(for example
> analogix_dp_bind/analogix_dp_unbind)
> or should the DRM core take care of that?
>
>>
>>> Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
>>> Signed-off-by: Thierry Escande <thierry.escande@collabora.com>
>>> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
>>> ---
next prev parent reply other threads:[~2018-03-05 7:01 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-02 17:57 [PATCH v9 0/5] rockchip: kevin: Enable edp display Enric Balletbo i Serra
2018-03-02 17:57 ` Enric Balletbo i Serra
2018-03-02 17:57 ` [PATCH v9 1/5] drm/rockchip: dw-mipi-dsi: Fix connector and encoder cleanup Enric Balletbo i Serra
2018-03-02 17:57 ` Enric Balletbo i Serra
2018-03-02 17:57 ` Enric Balletbo i Serra
2018-03-08 16:38 ` Heiko Stübner
2018-03-08 16:38 ` Heiko Stübner
2018-03-02 17:57 ` [PATCH v9 2/5] drm/rockchip: inno_hdmi: Fix error handling path Enric Balletbo i Serra
2018-03-02 17:57 ` Enric Balletbo i Serra
2018-03-08 16:38 ` Heiko Stübner
2018-03-08 16:38 ` Heiko Stübner
2018-03-08 16:38 ` Heiko Stübner
2018-03-02 17:57 ` [PATCH v9 3/5] drm/rockchip: inno_hdmi: reorder clk_disable_unprepare call in unbind Enric Balletbo i Serra
2018-03-02 17:57 ` Enric Balletbo i Serra
2018-03-08 16:38 ` Heiko Stübner
2018-03-08 16:38 ` Heiko Stübner
2018-03-08 16:38 ` Heiko Stübner
2018-03-02 17:57 ` [PATCH v9 4/5] drm/rockchip: dw_hdmi: Move HDMI vpll clock enable to bind() Enric Balletbo i Serra
2018-03-02 17:57 ` Enric Balletbo i Serra
2018-03-08 16:38 ` Heiko Stübner
2018-03-08 16:38 ` Heiko Stübner
2018-03-08 16:38 ` Heiko Stübner
2018-03-02 17:57 ` [PATCH v9 5/5] drm/bridge/synopsys: dw-hdmi: Add missing bridge detach Enric Balletbo i Serra
2018-03-02 17:57 ` Enric Balletbo i Serra
2018-03-02 21:49 ` Laurent Pinchart
2018-03-02 21:49 ` Laurent Pinchart
2018-03-02 21:49 ` Laurent Pinchart
2018-03-03 0:20 ` JeffyChen
2018-03-03 0:20 ` JeffyChen
2018-03-05 7:01 ` JeffyChen [this message]
2018-03-05 7:01 ` JeffyChen
2018-03-05 7:01 ` JeffyChen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5A9CEB44.40207@rock-chips.com \
--to=jeffy.chen@rock-chips.com \
--cc=Jose.Abreu@synopsys.com \
--cc=airlied@linux.ie \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=enric.balletbo@collabora.com \
--cc=hverkuil@xs4all.nl \
--cc=jernej.skrabec@siol.net \
--cc=kernel@collabora.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=narmstrong@baylibre.com \
--cc=rmk+kernel@armlinux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.