ARM Sunxi Platform Development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Cristian Ciocaltea" <cristian.ciocaltea@collabora.com>
Cc: linux-sunxi@lists.linux.dev, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v11 14/74] drm/bridge: Fix unlocked list access in drm_bridge_attach()
Date: Tue, 01 Sep 2026 19:16:21 +0000	[thread overview]
Message-ID: <20260901191621.C59A31F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260901-dw-hdmi-qp-scramb-v11-14-bc12954a0688@collabora.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Mixing goto-based error handling with scope-based cleanup helpers (`scoped_guard`) in the same function.
--

commit a312843839f1a20e85a81d94af26656e4dacb18f
Author: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>

drm/bridge: Fix unlocked list access in drm_bridge_attach()

This patch fixes an unlocked read of bridge->list in drm_bridge_attach()
by performing the check under bridge_lock. It uses the scoped_guard()
cleanup helper to manage the lock.

> diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
> index a8b6df5c13eaf..10dde3600c70a 100644
> --- a/drivers/gpu/drm/drm_bridge.c
> +++ b/drivers/gpu/drm/drm_bridge.c
> @@ -606,8 +606,10 @@ int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge,
>  	if (!bridge->container)
>  		DRM_WARN("DRM bridge corrupted or not allocated by devm_drm_bridge_alloc()\n");
>  
> -	if (list_empty(&bridge->list))
> -		DRM_WARN("Missing drm_bridge_add() before attach\n");
> +	scoped_guard(mutex, &bridge_lock) {
> +		if (list_empty(&bridge->list))
> +			DRM_WARN("Missing drm_bridge_add() before attach\n");
> +	}

[Severity: Low]
Does introducing scoped_guard() here conflict with the existing goto-based
error handling later in drm_bridge_attach()?

The kernel's cleanup.h guidelines forbid mixing goto-based cleanup and
scope-based cleanup helpers in the same function. drm_bridge_attach()
currently uses goto labels for resource unwinding:

    if (bridge->funcs->attach) {
        ret = bridge->funcs->attach(bridge, encoder, flags);
        if (ret < 0)
            goto err_reset_bridge;
    }

While this specific change doesn't cause a direct runtime leak since the
goto statements don't jump into or out of the scoped_guard block scope,
could this structural mixing cause issues later? Would it be safer to use
standard locking (mutex_lock and mutex_unlock) here to avoid mixing the
two paradigms?

>  
>  	drm_bridge_get(bridge);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260901-dw-hdmi-qp-scramb-v11-0-bc12954a0688@collabora.com?part=14

  reply	other threads:[~2026-09-01 19:16 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01 18:50 [PATCH v11 00/74] Add HDMI 2.0 support to DW HDMI QP TX Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 01/74] video/hdmi: Introduce HDMI version enum Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 02/74] drm/connector: hdmi: Handle reset() state allocation failure Cristian Ciocaltea
2026-09-01 19:07   ` sashiko-bot
2026-09-01 18:50 ` [PATCH v11 03/74] drm/display: hdmi: Rename drmm_connector_hdmi_init() to *_ini2() Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 04/74] drm/connector: Add drmm_connector_hdmi_init() with new signature Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 05/74] drm/display: bridge_connector: Convert to drmm_connector_hdmi_init() Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 06/74] drm/probe-helper: Introduce .force_ctx() connector callback Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 07/74] drm/connector: Add HDMI 2.0 scrambler infrastructure Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 08/74] drm/display: scdc-helper: Add macro for connector-prefixed debug messages Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 09/74] drm/display: scdc-helper: Add helper to set SCDC version information Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 10/74] drm/display: hdmi: Add HDMI 2.0 scrambling management helpers Cristian Ciocaltea
2026-09-01 19:18   ` sashiko-bot
2026-09-01 18:50 ` [PATCH v11 11/74] drm/display: hdmi: Advertise SCDC source version when scrambling Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 12/74] drm/bridge: Fix unlocked list_del in drm_bridge_add() Cristian Ciocaltea
2026-09-01 19:17   ` sashiko-bot
2026-09-01 18:50 ` [PATCH v11 13/74] drm/bridge: Fix NULL deref in drm_bridge_add() for legacy bridges Cristian Ciocaltea
2026-09-01 19:19   ` sashiko-bot
2026-09-01 18:50 ` [PATCH v11 14/74] drm/bridge: Fix unlocked list access in drm_bridge_attach() Cristian Ciocaltea
2026-09-01 19:16   ` sashiko-bot [this message]
2026-09-01 18:50 ` [PATCH v11 15/74] drm/bridge: Remove redundant error check in drm_bridge_helper_reset_crtc() Cristian Ciocaltea
2026-09-01 19:21   ` sashiko-bot
2026-09-01 18:50 ` [PATCH v11 16/74] drm/bridge: Add bridge ops for source-side HDMI 2.0 scrambling Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 17/74] drm/display: bridge_connector: Use cached connector status in .get_modes() Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 18/74] drm/display: bridge_connector: Switch to .detect_ctx() connector helper Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 19/74] drm/display: bridge_connector: Wire up HDMI 2.0 scrambler callbacks Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 20/74] drm/display: hdmi-state-helper: Add source TMDS rate validation Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 21/74] drm/display: hdmi-state-helper: Pass acquire ctx to hotplug helpers Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 22/74] drm/display: hdmi-state-helper: Add drm_atomic_helper_connector_hdmi_force_ctx() Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 23/74] drm/display: hdmi-state-helper: Sync SCDC state on hotplug Cristian Ciocaltea
2026-09-01 19:40   ` sashiko-bot
2026-09-01 18:50 ` [PATCH v11 24/74] drm/display: hdmi-state-helper: Set HDMI scrambling requirement Cristian Ciocaltea
2026-09-01 19:39   ` sashiko-bot
2026-09-01 18:50 ` [PATCH v11 25/74] drm/display: bridge_connector: Switch to .force_ctx() connector helper Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 26/74] drm/bridge: dw-hdmi-qp: Rate limit i2c read error messages Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 27/74] drm/bridge: dw-hdmi-qp: Provide .{enable,disable}_hpd() PHY ops Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 28/74] drm/bridge: dw-hdmi-qp: Remove unused workqueue include and define Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 29/74] drm/bridge: dw-hdmi-qp: Add HDMI 2.0 scrambling support Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 30/74] drm/bridge: dw-hdmi-qp: Provide dw_hdmi_qp_hpd_notify() helper Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 31/74] drm/rockchip: dw_hdmi_qp: Fix invalid drvdata access in PM ops Cristian Ciocaltea
2026-09-01 19:46   ` sashiko-bot
2026-09-01 18:50 ` [PATCH v11 32/74] drm/rockchip: dw_hdmi_qp: Cancel pending HPD work on suspend Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 33/74] drm/rockchip: dw_hdmi_qp: Add missing newlines in dev_err_probe() messages Cristian Ciocaltea
2026-09-01 19:52   ` sashiko-bot
2026-09-01 18:50 ` [PATCH v11 34/74] drm/rockchip: dw_hdmi_qp: Use local dev variable consistently in bind() Cristian Ciocaltea
2026-09-01 18:50 ` [PATCH v11 35/74] drm/rockchip: dw_hdmi_qp: Avoid spurious HPD IRQ thread wakeups Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 36/74] drm/rockchip: dw_hdmi_qp: Mask RK3576 HPD IRQ in io_init Cristian Ciocaltea
2026-09-01 19:50   ` sashiko-bot
2026-09-01 18:51 ` [PATCH v11 37/74] drm/rockchip: dw_hdmi_qp: Implement .{enable,disable}_hpd() PHY ops Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 38/74] drm/rockchip: dw_hdmi_qp: Factor out HPD interrupt (un)mask helpers Cristian Ciocaltea
2026-09-01 19:55   ` sashiko-bot
2026-09-01 18:51 ` [PATCH v11 39/74] drm/rockchip: dw_hdmi_qp: Control the HPD IRQ line via the bridge HPD ops Cristian Ciocaltea
2026-09-01 20:03   ` sashiko-bot
2026-09-01 18:51 ` [PATCH v11 40/74] drm/rockchip: dw_hdmi_qp: Use dw_hdmi_qp_hpd_notify() for HPD reports Cristian Ciocaltea
2026-09-01 20:05   ` sashiko-bot
2026-09-01 18:51 ` [PATCH v11 41/74] drm/bridge: dw-hdmi-qp: Drop unused .setup_hpd() phy op Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 42/74] drm/vc4: hdmi: Use common TMDS char rate constants Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 43/74] drm/vc4: hdmi: Switch to drm_hdmi_mode_needs_scrambling() Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 44/74] drm/vc4: hdmi: Switch to .force_ctx() connector helper Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 45/74] drm/vc4: hdmi: Propagate -EDEADLK to the top level Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 46/74] drm/vc4: hdmi: Convert to drmm_connector_hdmi_init() Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 47/74] drm/vc4: hdmi: Convert to common HDMI 2.0 scrambling infrastructure Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 48/74] drm/vc4: hdmi: Defer pixel clock validation to HDMI helpers Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 49/74] drm/display: hdmi-state-helper: Drop drm_atomic_helper_connector_hdmi_force() Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 50/74] drm/bridge: adv7511: Advertise HDMI 1.2 capabilities Cristian Ciocaltea
2026-09-01 20:17   ` sashiko-bot
2026-09-01 18:51 ` [PATCH v11 51/74] drm/bridge: inno-hdmi: " Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 52/74] drm/bridge: ite-it6263: Drop redundant .mode_valid hook Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 53/74] drm/bridge: ite-it6263: Advertise HDMI 1.3 capabilities Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 54/74] drm/bridge: ite-it66121: Advertise HDMI 1.2 capabilities Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 55/74] drm/bridge: lontium-lt9611: Advertise HDMI 1.4 capabilities Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 56/74] drm/rockchip: rk3066_hdmi: " Cristian Ciocaltea
2026-09-01 20:24   ` sashiko-bot
2026-09-01 18:51 ` [PATCH v11 57/74] drm/sun4i: hdmi: Convert to drmm_connector_hdmi_init() Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 58/74] drm/tests: edid: Add 4K@60Hz EDID with 600MHz TMDS Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 59/74] drm/tests: edid: Fix conformity for 1080p+4K YUV420 200MHz EDID Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 60/74] drm/tests: edid: Fix conformity for 4K RGB/YUV 340MHz EDID Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 61/74] drm/tests: bridge: Set supported HDMI version Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 62/74] drm/tests: connector: Convert to drmm_connector_hdmi_init() Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 63/74] drm/tests: connector: Add HDMI max_tmds_char_rate init coverage Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 64/74] drm/tests: connector: Add HDMI source-side scrambler coverage Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 65/74] drm/tests: hdmi_state_helper: Convert to drmm_connector_hdmi_init() Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 66/74] drm/tests: hdmi_state_helper: Add connector-provided max_tmds_char_rate coverage Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 67/74] drm/tests: hdmi_state_helper: Cover source-side scrambling decision Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 68/74] drm/connector: Remove drmm_connector_hdmi_ini2() Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 69/74] drm/connector: Drop redundant hdmi vendor/product fields Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 70/74] drm/connector: Drop redundant hdmi supported_formats field Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 71/74] drm/connector: Drop redundant max_bpc field Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 72/74] video/hdmi: Define SPD InfoFrame field lengths and use strtomem_pad() Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 73/74] drm/connector: Use the SPD InfoFrame field length defines Cristian Ciocaltea
2026-09-01 18:51 ` [PATCH v11 74/74] drm/tests: hdmi: Add SPD InfoFrame vendor/product coverage Cristian Ciocaltea

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=20260901191621.C59A31F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=cristian.ciocaltea@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    /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