Message ID | 20220311093406.4068019-3-ricardo.canuelo@collabora.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Mitigate race condition problems when unbinding DRM driver | expand |
Il 11/03/22 10:34, Ricardo Cañuelo ha scritto: > 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> On various chromebooks with different MediaTek SoC models, and on Qualcomm SC7180 Trogdor, Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
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;
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(-)