[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250407145847.1016528-1-chenyuan0y@gmail.com>
Date: Mon, 7 Apr 2025 09:58:47 -0500
From: Chenyuan Yang <chenyuan0y@...il.com>
To: patrik.r.jakobsson@...il.com,
maarten.lankhorst@...ux.intel.com,
mripard@...nel.org,
tzimmermann@...e.de,
airlied@...il.com,
simona@...ll.ch,
airlied@...hat.com,
yakui.zhao@...el.com,
alan@...ux.intel.com
Cc: dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org,
Chenyuan Yang <chenyuan0y@...il.com>
Subject: [PATCH] gma500/cdv: fix null pointer dereference in cdv_intel_dp_get_modes
In cdv_intel_dp_get_modes(), the return value of drm_mode_duplicate()
is assigned to mode, which will lead to a NULL pointer dereference on
failure of drm_mode_duplicate(). Add a check to avoid npd.
This is similar to the fix commit cb520c3f366c
("drm/gma500: fix null pointer dereference in cdv_intel_lvds_get_modes").
This is found by our static analysis tool KNighter.
Signed-off-by: Chenyuan Yang <chenyuan0y@...il.com>
Fixes: d112a8163f83 ("gma500/cdv: Add eDP support")
---
drivers/gpu/drm/gma500/cdv_intel_dp.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/gma500/cdv_intel_dp.c b/drivers/gpu/drm/gma500/cdv_intel_dp.c
index c85143792019..4bd66804bc09 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_dp.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_dp.c
@@ -1767,6 +1767,9 @@ static int cdv_intel_dp_get_modes(struct drm_connector *connector)
if (intel_dp->panel_fixed_mode != NULL) {
struct drm_display_mode *mode;
mode = drm_mode_duplicate(dev, intel_dp->panel_fixed_mode);
+ if (!mode)
+ return ret;
+
drm_mode_probed_add(connector, mode);
return 1;
}
--
2.34.1
Powered by blists - more mailing lists