lkml.org 
[lkml]   [2023]   [Jan]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v3] drm/msm/dsi: Add missing check for alloc_ordered_workqueue
    Date
    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>
    ---
    Changelog:

    v2 -> v3:

    1. Simply return -ENOMEM instead of using ret.
    2. No change of the "goto fail".

    v1 -> v2:

    1. Change the "goto fail" into "return ret" and drop the "fail" label.
    ---
    drivers/gpu/drm/msm/dsi/dsi_host.c | 3 +++
    1 file changed, 3 insertions(+)

    diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
    index 89aadd3b3202..f167a45f1fbd 100644
    --- a/drivers/gpu/drm/msm/dsi/dsi_host.c
    +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
    @@ -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;
    --
    2.25.1
    \
     
     \ /
      Last update: 2023-03-26 23:34    [W:9.661 / U:0.108 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site