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

余治国 hymmsx.yu at gmail.com
Wed Apr 19 03:04:54 UTC 2023


The log looks like this:
[ 31.723823] Internal error: Oops: 96000004 [#1] SMP\013 \010
[ 31.729030] Modules linked in:\013 \010
[ 31.733395] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.10.59+2.0.0
#250\013
\010
[ 31.745167] pstate: 60c00005 (nZCv daif +PAN +UAO -TCO BTYPE=--)\013 \010
[ 31.752785] pc : drm_bridge_attach+0xdc/0x1a4\013 \010
[ 31.757518] lr : drm_bridge_attach+0x40/0x1a4\013 \010
[ 31.762104] sp : ffff0000000678f0\013 \010
[ 31.765726] x29: ffff0000000678f0 x28: ffff00000031c880 \013 \010
[ 31.771599] x27: 0000000000000060 x26: ffff800010539e90 \013 \010
[ 31.777340] x25: ffff0000000a6000 x24: ffff000000129c10 \013 \010
[ 31.783060] x23: 0000000000000000 x22: ffff0000000131c0 \013 \010
[ 31.788770] x21: ffff80001052a5b8 x20: ffff0000003e2c80 \013 \010
[ 31.794506] x19: ffff000000017080 x18: 0000000000000010 \013 \010
[ 31.800210] x17: 000000005fcfcd6c x16: 00000000d27b105e \013 \010
[ 31.805907] x15: 00000000000000c7 x14: ffff0000000675d0 \013 \010
[ 31.811599] x13: 00000000ffffffea x12: ffff8000114158c0 \013 \010
[ 31.817282] x11: 0000000000000003 x10: ffff800011295880 \013 \010
[ 31.823000] x9 : ffff8000112958d8 x8 : 000000000017ffe8 \013 \010
[ 31.828731] x7 : c0000000fffeffff x6 : 0000000000000001 \013 \010
[ 31.834425] x5 : 000000000057ffa8 x4 : 0000000000000000 \013 \010
[ 31.840101] x3 : 0000000000000000 x2 : ffff000000013218 \013 \010
[ 31.845787] x1 : ffff0000003e2cf8 x0 : 0000000000000000 \013 \010
[ 31.851594] Call trace:\013 \010
[ 31.854603] drm_bridge_attach+0xdc/0x1a4\013 \010
[ 31.859079] dw_mipi_dsi_bridge_attach+0x98/0xa8\013 \010
[ 31.864035] drm_bridge_attach+0x104/0x1a4\013 \010
[ 31.869211] dw_mipi_dsi_bind+0x24/0x58\013 \010
drm_bridge_attach will call bridge->funcs in many cases, so I think it is
necessary to check。


Jagan Teki <jagan at amarulasolutions.com> 于2023年4月18日周二 21:45写道:

> 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.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20230419/b8f4f3c2/attachment.htm>


More information about the dri-devel mailing list