[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <955fbabe-e5f2-cfff-8dfd-1730243b0fff@codeaurora.org>
Date: Sat, 23 Mar 2019 15:35:15 +0530
From: Mukesh Ojha <mojha@...eaurora.org>
To: Kangjie Lu <kjlu@....edu>
Cc: pakki001@....edu, Rodrigo Siqueira <rodrigosiqueiramelo@...il.com>,
Haneen Mohammed <hamohammed.sa@...il.com>,
Daniel Vetter <daniel@...ll.ch>,
David Airlie <airlied@...ux.ie>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm: vkms: check status of alloc_ordered_workqueue
On 3/9/2019 10:06 AM, Kangjie Lu wrote:
> alloc_ordered_workqueue may fail and return NULL.
> The fix returns ENOMEM when it fails to avoid potential NULL
> pointer dereference.
>
> Signed-off-by: Kangjie Lu <kjlu@....edu>
> ---
> drivers/gpu/drm/vkms/vkms_crtc.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
> index 8a9aeb0a9ea8..bb66dbcd5e3f 100644
> --- a/drivers/gpu/drm/vkms/vkms_crtc.c
> +++ b/drivers/gpu/drm/vkms/vkms_crtc.c
> @@ -219,6 +219,8 @@ int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
> spin_lock_init(&vkms_out->state_lock);
>
> vkms_out->crc_workq = alloc_ordered_workqueue("vkms_crc_workq", 0);
> + if (!vkms_out->crc_workq)
> + return -ENOMEM;
>
> return ret;
> }
Check the clean up path more carefully, you have undo which you have
done successfully in drm_crtc_init_with_planes.
Thanks,
Mukesh
Powered by blists - more mailing lists