Commit 1556a052 authored by Ma Ke's avatar Ma Ke Committed by Liu Chuang
Browse files

drm: omapdrm: Add missing check for alloc_ordered_workqueue

stable inclusion
from stable-v5.10.227
commit 2bda89735199683b03f55b807bd1e31a3857520b
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IAYR94
CVE: CVE-2024-49879

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=2bda89735199683b03f55b807bd1e31a3857520b



--------------------------------

commit e794b7b9b92977365c693760a259f8eef940c536 upstream.

As it may return NULL pointer and cause NULL pointer dereference. Add check
for the return value of alloc_ordered_workqueue.

Cc: stable@vger.kernel.org
Fixes: 2f95bc6d ("drm: omapdrm: Perform initialization/cleanup at probe/remove time")
Signed-off-by: default avatarMa Ke <make24@iscas.ac.cn>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240808061336.2796729-1-make24@iscas.ac.cn


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarLiu Chuang <liuchuang40@huawei.com>
parent 0c901c96
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -600,6 +600,10 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
	soc = soc_device_match(omapdrm_soc_devices);
	priv->omaprev = soc ? (unsigned int)soc->data : 0;
	priv->wq = alloc_ordered_workqueue("omapdrm", 0);
	if (!priv->wq) {
		ret = -ENOMEM;
		goto err_alloc_workqueue;
	}

	mutex_init(&priv->list_lock);
	INIT_LIST_HEAD(&priv->obj_list);
@@ -649,6 +653,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
err_gem_deinit:
	omap_gem_deinit(ddev);
	destroy_workqueue(priv->wq);
err_alloc_workqueue:
	omap_disconnect_pipelines(ddev);
	omap_crtc_pre_uninit(priv);
	drm_dev_put(ddev);