drm/msm/dsi: Add missing check for alloc_ordered_workqueue
authorJiasheng Jiang <jiasheng@iscas.ac.cn>
Tue, 10 Jan 2023 02:16:51 +0000 (10:16 +0800)
committerDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Sun, 22 Jan 2023 20:42:57 +0000 (22:42 +0200)
Add check for the return value of alloc_ordered_workqueue as it may return
NULL pointer and cause NULL pointer dereference.

Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Patchwork: https://patchwork.freedesktop.org/patch/517646/
Link: https://lore.kernel.org/r/20230110021651.12770-1-jiasheng@iscas.ac.cn
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
drivers/gpu/drm/msm/dsi/dsi_host.c

index 89aadd3..f167a45 100644 (file)
@@ -1977,6 +1977,9 @@ int msm_dsi_host_init(struct msm_dsi *msm_dsi)
 
        /* setup workqueue */
        msm_host->workqueue = alloc_ordered_workqueue("dsi_drm_work", 0);
+       if (!msm_host->workqueue)
+               return -ENOMEM;
+
        INIT_WORK(&msm_host->err_work, dsi_err_worker);
 
        msm_dsi->id = msm_host->id;