This is a note to let you know that I've just added the patch titled drm/panel: himax-hx83102: Add a check to prevent NULL pointer dereference to the 6.12-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: drm-panel-himax-hx83102-add-a-check-to-prevent-null-.patch and it can be found in the queue-6.12 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 43d6b0a3525f5334f0b715c7ae763fa30cc99374 Author: Zhang Zekun <zhangzekun11@xxxxxxxxxx> Date: Fri Oct 25 15:34:08 2024 +0800 drm/panel: himax-hx83102: Add a check to prevent NULL pointer dereference [ Upstream commit e1e1af9148dc4c866eda3fb59cd6ec3c7ea34b1d ] drm_mode_duplicate() could return NULL due to lack of memory, which will then call NULL pointer dereference. Add a check to prevent it. Fixes: 0ef94554dc40 ("drm/panel: himax-hx83102: Break out as separate driver") Signed-off-by: Zhang Zekun <zhangzekun11@xxxxxxxxxx> Reviewed-by: Neil Armstrong <neil.armstrong@xxxxxxxxxx> Link: https://lore.kernel.org/r/20241025073408.27481-3-zhangzekun11@xxxxxxxxxx Signed-off-by: Neil Armstrong <neil.armstrong@xxxxxxxxxx> Link: https://patchwork.freedesktop.org/patch/msgid/20241025073408.27481-3-zhangzekun11@xxxxxxxxxx Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/drivers/gpu/drm/panel/panel-himax-hx83102.c b/drivers/gpu/drm/panel/panel-himax-hx83102.c index 8b48bba18131..3644a7544b93 100644 --- a/drivers/gpu/drm/panel/panel-himax-hx83102.c +++ b/drivers/gpu/drm/panel/panel-himax-hx83102.c @@ -565,6 +565,8 @@ static int hx83102_get_modes(struct drm_panel *panel, struct drm_display_mode *mode; mode = drm_mode_duplicate(connector->dev, m); + if (!mode) + return -ENOMEM; mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; drm_mode_set_name(mode);