mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Michel Dänzer" <michel@daenzer.net>
To: Allen Pais <allen.pais@oracle.com>
Cc: dri-devel@lists.freedesktop.org, airlied@linux.ie,
	linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/radeon: fix a potential NULL pointer dereference
Date: Thu, 19 Sep 2019 19:11:42 +0200	[thread overview]
Message-ID: <5603dddb-8ae3-e145-69af-c6ccea68ca1b@daenzer.net> (raw)
In-Reply-To: <1568824282-4081-1-git-send-email-allen.pais@oracle.com>

On 2019-09-18 6:31 p.m., Allen Pais wrote:
> alloc_workqueue is not checked for errors and as a result,
> a potential NULL dereference could occur.
> 
> Signed-off-by: Allen Pais <allen.pais@oracle.com>
> ---
>  drivers/gpu/drm/radeon/radeon_display.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
> index bd52f15..1a41764 100644
> --- a/drivers/gpu/drm/radeon/radeon_display.c
> +++ b/drivers/gpu/drm/radeon/radeon_display.c
> @@ -683,6 +683,10 @@ static void radeon_crtc_init(struct drm_device *dev, int index)
>  	drm_mode_crtc_set_gamma_size(&radeon_crtc->base, 256);
>  	radeon_crtc->crtc_id = index;
>  	radeon_crtc->flip_queue = alloc_workqueue("radeon-crtc", WQ_HIGHPRI, 0);
> +	if (unlikely(!radeon_crtc->flip_queue)) {
> +		kfree(radeon_crtc);
> +		return;
> +	}
>  	rdev->mode_info.crtcs[index] = radeon_crtc;
>  
>  	if (rdev->family >= CHIP_BONAIRE) {
> 

I'm afraid just silently leaving the CRTC uninitialized isn't a good way
to handle this. The failure would need to be propagated, probably
resulting in the driver aborting its initialization altogether.


-- 
Earthling Michel Dänzer               |               https://redhat.com
Libre software enthusiast             |             Mesa and X developer

      reply	other threads:[~2019-09-19 17:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-18 16:31 Allen Pais
2019-09-19 17:11 ` Michel Dänzer [this message]

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=5603dddb-8ae3-e145-69af-c6ccea68ca1b@daenzer.net \
    --to=michel@daenzer.net \
    --cc=airlied@linux.ie \
    --cc=allen.pais@oracle.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®