dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Mukesh Ojha <mojha@codeaurora.org>
To: Kangjie Lu <kjlu@umn.edu>
Cc: pakki001@umn.edu,
	Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>,
	Haneen Mohammed <hamohammed.sa@gmail.com>,
	Daniel Vetter <daniel@ffwll.ch>, David Airlie <airlied@linux.ie>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm: vkms: check status of alloc_ordered_workqueue
Date: Sat, 23 Mar 2019 15:35:15 +0530	[thread overview]
Message-ID: <955fbabe-e5f2-cfff-8dfd-1730243b0fff@codeaurora.org> (raw)
In-Reply-To: <20190309043628.6078-1-kjlu@umn.edu>


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@umn.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

  parent reply	other threads:[~2019-03-23 10:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-09  4:36 [PATCH] drm: vkms: check status of alloc_ordered_workqueue Kangjie Lu
2019-03-23  2:32 ` Kangjie Lu
2019-03-25  8:34   ` Daniel Vetter
2019-03-23 10:05 ` Mukesh Ojha [this message]
2019-03-23 21:42   ` [PATCH v2] " Kangjie Lu
2019-03-25  8:31     ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=955fbabe-e5f2-cfff-8dfd-1730243b0fff@codeaurora.org \
    --to=mojha@codeaurora.org \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hamohammed.sa@gmail.com \
    --cc=kjlu@umn.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pakki001@umn.edu \
    --cc=rodrigosiqueiramelo@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).