From: "Ricardo Cañuelo" <ricardo.canuelo@collabora.com>
To: dri-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org,
kernel@collabora.com, andrzej.hajda@intel.com,
narmstrong@baylibre.com, maarten.lankhorst@linux.intel.com,
mripard@kernel.org
Subject: [PATCH 2/2 RESEND] drm/bridge: Add extra checks in pre_enable and post_enable
Date: Fri, 11 Mar 2022 10:34:06 +0100 [thread overview]
Message-ID: <20220311093406.4068019-3-ricardo.canuelo@collabora.com> (raw)
In-Reply-To: <20220311093406.4068019-1-ricardo.canuelo@collabora.com>
Depending on the bridge code, certain userspace events during a driver
teardown (such as a DRM ioctl call) might cause a race condition where
the drm_bridge_chain_pre_enable() and drm_bridge_chain_post_enable()
functions could be called for a bridge that has just been detached and
removed from the bridge chain of an encoder.
This change makes these functions a bit more robust by bailing out if
the bridge has already been detached.
Tested on an Acer Chromebook R13 (Elm, MT8173) with Debian Sid.
Signed-off-by: Ricardo Cañuelo <ricardo.canuelo@collabora.com>
---
drivers/gpu/drm/drm_bridge.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
index c96847fc0ebc..e074aa456dd1 100644
--- a/drivers/gpu/drm/drm_bridge.c
+++ b/drivers/gpu/drm/drm_bridge.c
@@ -529,7 +529,7 @@ void drm_bridge_chain_post_disable(struct drm_bridge *bridge)
{
struct drm_encoder *encoder;
- if (!bridge)
+ if (!bridge || !bridge->dev)
return;
encoder = bridge->encoder;
@@ -585,7 +585,7 @@ void drm_bridge_chain_pre_enable(struct drm_bridge *bridge)
struct drm_encoder *encoder;
struct drm_bridge *iter;
- if (!bridge)
+ if (!bridge || !bridge->dev)
return;
encoder = bridge->encoder;
--
2.25.1
next prev parent reply other threads:[~2022-03-11 9:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-11 9:34 [PATCH 0/2 RESEND] Mitigate race condition problems when unbinding DRM driver Ricardo Cañuelo
2022-03-11 9:34 ` [PATCH 1/2 RESEND] drm/bridge: parade-ps8640: avoid race condition on driver unbinding Ricardo Cañuelo
2022-03-18 10:21 ` AngeloGioacchino Del Regno
2022-03-11 9:34 ` Ricardo Cañuelo [this message]
2022-03-18 10:21 ` [PATCH 2/2 RESEND] drm/bridge: Add extra checks in pre_enable and post_enable AngeloGioacchino Del Regno
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=20220311093406.4068019-3-ricardo.canuelo@collabora.com \
--to=ricardo.canuelo@collabora.com \
--cc=andrzej.hajda@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=narmstrong@baylibre.com \
/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®