]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm: omapdrm: Add missing check for alloc_ordered_workqueue
authorMa Ke <make24@iscas.ac.cn>
Thu, 8 Aug 2024 06:13:36 +0000 (14:13 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Oct 2024 13:10:30 +0000 (15:10 +0200)
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: 2f95bc6d324a ("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>
drivers/gpu/drm/omapdrm/omap_drv.c

index 60871d255a4df76d8ad9f5133f84693fbcd1ac20..939597ab5b76d307964c379a011b18c9e0612e06 100644 (file)
@@ -573,6 +573,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);
@@ -620,6 +624,7 @@ err_cleanup_modeset:
 err_gem_deinit:
        omap_gem_deinit(ddev);
        destroy_workqueue(priv->wq);
+err_alloc_workqueue:
        omap_disconnect_pipelines(ddev);
        drm_dev_put(ddev);
        return ret;