From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
To: Ying Liu <victor.liu@nxp.com>,
"andrzej.hajda@intel.com" <andrzej.hajda@intel.com>
Cc: "neil.armstrong@linaro.org" <neil.armstrong@linaro.org>,
"rfoss@kernel.org" <rfoss@kernel.org>,
"Laurent.pinchart@ideasonboard.com"
<Laurent.pinchart@ideasonboard.com>,
"jonas@kwiboo.se" <jonas@kwiboo.se>,
"jernej.skrabec@gmail.com" <jernej.skrabec@gmail.com>,
"airlied@gmail.com" <airlied@gmail.com>,
"daniel@ffwll.ch" <daniel@ffwll.ch>,
"ulf.hansson@linaro.org" <ulf.hansson@linaro.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"kernel@collabora.com" <kernel@collabora.com>,
"ehristev@collabora.com" <ehristev@collabora.com>,
"wenst@chromium.org" <wenst@chromium.org>
Subject: Re: [PATCH] drm/bridge: panel: Fix device link for DRM_BRIDGE_ATTACH_NO_CONNECTOR
Date: Wed, 20 Sep 2023 10:24:39 +0200 [thread overview]
Message-ID: <6cde344a-9e93-07b0-862b-aa401e6c64fb@collabora.com> (raw)
In-Reply-To: <AM7PR04MB70466D88048831E48EBBBD0898FAA@AM7PR04MB7046.eurprd04.prod.outlook.com>
Il 19/09/23 03:45, Ying Liu ha scritto:
> Hi Angelo,
>
> Thank you for the patch.
>
> On Monday, September 18, 2023 11:01 PM, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> wrote:
>> When external bridges are attached with
>> DRM_BRIDGE_ATTACH_NO_CONNECTOR,
>> the panel bridge may also get the same flag, but in the .attach()
>> callback for the panel bridge a device link is added only when this
>> flag is not present; To make things worse, the .detach() callback
>> tries to delete the device link unconditionally and without checking
>> if it was created in the first place, crashing the kernel with a NULL
>> pointer kernel panic upon calling panel_bridge_detach().
>>
>> Fix that by moving the device_link_add() call before checking if the
>> DRM_BRIDGE_ATTACH_NO_CONNECTOR flag is present.
>>
>> Fixes: 199cf07ebd2b ("drm/bridge: panel: Add a device link between drm
>> device and panel device")
>> Signed-off-by: AngeloGioacchino Del Regno
>> <angelogioacchino.delregno@collabora.com>
>> ---
>> drivers/gpu/drm/bridge/panel.c | 16 ++++++++--------
>> 1 file changed, 8 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/bridge/panel.c
>> b/drivers/gpu/drm/bridge/panel.c
>> index e00d2e94c751..8c507dfd589e 100644
>> --- a/drivers/gpu/drm/bridge/panel.c
>> +++ b/drivers/gpu/drm/bridge/panel.c
>> @@ -67,14 +67,6 @@ static int panel_bridge_attach(struct drm_bridge
>> *bridge,
>> struct drm_device *drm_dev = bridge->dev;
>> int ret;
>>
>> - if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)
>> - return 0;
>> -
>> - if (!bridge->encoder) {
>> - DRM_ERROR("Missing encoder\n");
>> - return -ENODEV;
>> - }
>> -
>> panel_bridge->link = device_link_add(drm_dev->dev, panel->dev,
>> DL_FLAG_STATELESS);
>> if (!panel_bridge->link) {
>> @@ -83,6 +75,14 @@ static int panel_bridge_attach(struct drm_bridge
>> *bridge,
>> return -EINVAL;
>> }
>>
>> + if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)
>> + return 0;
>> +
>> + if (!bridge->encoder) {
>> + DRM_ERROR("Missing encoder\n");
>
> Shouldn't the device link be deleted in case of error?
>
Whoops! Yes, that's right. I'm sending a v2 right now.
Thanks!
Angelo
> Regards,
> Liu Ying
>
>> + return -ENODEV;
>> + }
>> +
>> drm_connector_helper_add(connector,
>> &panel_bridge_connector_helper_funcs);
>>
>> --
>> 2.42.0
>
prev parent reply other threads:[~2023-09-20 8:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-18 15:00 AngeloGioacchino Del Regno
2023-09-19 1:45 ` Ying Liu
2023-09-20 8:24 ` AngeloGioacchino Del Regno [this message]
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=6cde344a-9e93-07b0-862b-aa401e6c64fb@collabora.com \
--to=angelogioacchino.delregno@collabora.com \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=andrzej.hajda@intel.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=ehristev@collabora.com \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=rfoss@kernel.org \
--cc=ulf.hansson@linaro.org \
--cc=victor.liu@nxp.com \
--cc=wenst@chromium.org \
/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 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®