Skip to content

Commit

Permalink
drm: omapdrm: Add missing check for alloc_ordered_workqueue
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ma Ke authored and gregkh committed Oct 17, 2024
1 parent 3e88628 commit 2bda897
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/gpu/drm/omapdrm/omap_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 2bda897

Please sign in to comment.