* [PATCH v3] drm/msm/dsi: Add missing check for alloc_ordered_workqueue
@ 2023-01-10 2:16 Jiasheng Jiang
2023-01-10 3:30 ` [Freedreno] " Abhinav Kumar
2023-01-18 2:06 ` Dmitry Baryshkov
0 siblings, 2 replies; 3+ messages in thread
From: Jiasheng Jiang @ 2023-01-10 2:16 UTC (permalink / raw)
To: dmitry.baryshkov, d-gole
Cc: robdclark, quic_abhinavk, sean, airlied, daniel, marijn.suijten,
vkoul, dianders, marex, vladimir.lypak, linux-arm-msm, dri-devel,
freedreno, linux-kernel, Jiasheng Jiang
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Freedreno] [PATCH v3] drm/msm/dsi: Add missing check for alloc_ordered_workqueue
2023-01-10 2:16 [PATCH v3] drm/msm/dsi: Add missing check for alloc_ordered_workqueue Jiasheng Jiang
@ 2023-01-10 3:30 ` Abhinav Kumar
2023-01-18 2:06 ` Dmitry Baryshkov
1 sibling, 0 replies; 3+ messages in thread
From: Abhinav Kumar @ 2023-01-10 3:30 UTC (permalink / raw)
To: Jiasheng Jiang, dmitry.baryshkov, d-gole
Cc: marex, vkoul, sean, vladimir.lypak, dri-devel, dianders,
robdclark, daniel, linux-arm-msm, marijn.suijten, freedreno,
airlied, linux-kernel
On 1/9/2023 6:16 PM, Jiasheng Jiang wrote:
> 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>
> ---
> 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;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] drm/msm/dsi: Add missing check for alloc_ordered_workqueue
2023-01-10 2:16 [PATCH v3] drm/msm/dsi: Add missing check for alloc_ordered_workqueue Jiasheng Jiang
2023-01-10 3:30 ` [Freedreno] " Abhinav Kumar
@ 2023-01-18 2:06 ` Dmitry Baryshkov
1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Baryshkov @ 2023-01-18 2:06 UTC (permalink / raw)
To: d-gole, Jiasheng Jiang
Cc: robdclark, quic_abhinavk, sean, airlied, daniel, marijn.suijten,
vkoul, dianders, marex, vladimir.lypak, linux-arm-msm, dri-devel,
freedreno, linux-kernel
On Tue, 10 Jan 2023 10:16:51 +0800, Jiasheng Jiang wrote:
> Add check for the return value of alloc_ordered_workqueue as it may return
> NULL pointer and cause NULL pointer dereference.
>
>
Applied, thanks!
[1/1] drm/msm/dsi: Add missing check for alloc_ordered_workqueue
https://gitlab.freedesktop.org/lumag/msm/-/commit/e5237cd6ad68
Best regards,
--
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-01-18 2:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-10 2:16 [PATCH v3] drm/msm/dsi: Add missing check for alloc_ordered_workqueue Jiasheng Jiang
2023-01-10 3:30 ` [Freedreno] " Abhinav Kumar
2023-01-18 2:06 ` Dmitry Baryshkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®