Skip to content

Commit b57b53e

Browse files
Ma Kegregkh
authored andcommitted
drm: omapdrm: Add missing check for alloc_ordered_workqueue
commit e794b7b 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: 2f95bc6 ("drm: omapdrm: Perform initialization/cleanup at probe/remove time") Signed-off-by: Ma Ke <make24@iscas.ac.cn> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240808061336.2796729-1-make24@iscas.ac.cn Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 0022085 commit b57b53e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/gpu/drm/omapdrm/omap_drv.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,10 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
695695
soc = soc_device_match(omapdrm_soc_devices);
696696
priv->omaprev = soc ? (uintptr_t)soc->data : 0;
697697
priv->wq = alloc_ordered_workqueue("omapdrm", 0);
698+
if (!priv->wq) {
699+
ret = -ENOMEM;
700+
goto err_alloc_workqueue;
701+
}
698702

699703
mutex_init(&priv->list_lock);
700704
INIT_LIST_HEAD(&priv->obj_list);
@@ -753,6 +757,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
753757
drm_mode_config_cleanup(ddev);
754758
omap_gem_deinit(ddev);
755759
destroy_workqueue(priv->wq);
760+
err_alloc_workqueue:
756761
omap_disconnect_pipelines(ddev);
757762
drm_dev_put(ddev);
758763
return ret;

0 commit comments

Comments
 (0)