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

logic.yu hymmsx.yu at gmail.com
Fri Apr 14 18:16:41 UTC 2023


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)
 		return -EINVAL;
 
 	if (previous && (!previous->dev || previous->encoder != encoder))
-- 
2.17.1



More information about the dri-devel mailing list