[PATCH] drm/bridge:Fix the panic problem caused by bridge->funcs->attach

Jagan Teki jagan at amarulasolutions.com
Tue Apr 18 13:45:19 UTC 2023


On Mon, Apr 17, 2023 at 12:52 PM logic.yu <hymmsx.yu at gmail.com> wrote:
>
> When the code is executed to bridge->funcs->attach,bridge->funcs is NULL.
> Although the function entry checks whether the bridge pointer is NULL,it
> does not detect whether the bridge->funcs is NULL, so a panic error
> occurs.
>
> Signed-off-by: logic.yu <hymmsx.yu at gmail.com>
> ---
>  drivers/gpu/drm/drm_bridge.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
> index c3d69af02e79..f3dd67fb3f1d 100644
> --- a/drivers/gpu/drm/drm_bridge.c
> +++ b/drivers/gpu/drm/drm_bridge.c
> @@ -302,7 +302,7 @@ int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge,
>  {
>         int ret;
>
> -       if (!encoder || !bridge)
> +       if (!encoder || !bridge || !bridge->funcs)

Would you please share the use case log where you found panic? I think
checking bridge->funcs during funcs-> trigger later in this function
would be a valid check (assume if an issue) as some drivers use the
bridge to handle downstream bridge w/o using any bridge functions.

Jagan.


More information about the dri-devel mailing list