All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Price <steven.price@arm.com>
To: Liviu Dudau <liviu.dudau@arm.com>
Cc: "James \(Qian\) Wang" <james.qian.wang@arm.com>,
	dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH] drm/komeda: return early if drm_universal_plane_init() fails.
Date: Fri, 3 Dec 2021 10:25:16 +0000	[thread overview]
Message-ID: <15e178b3-a181-ebd6-a372-f621c8e9d2d2@arm.com> (raw)
In-Reply-To: <20211203100946.2706922-1-liviu.dudau@arm.com>

On 03/12/2021 10:09, Liviu Dudau wrote:
> If drm_universal_plane_init() fails early we jump to the common cleanup code
> that calls komeda_plane_destroy() which in turn could access the uninitalised
> drm_plane and crash. Return early if an error is detected without going through
> the common code.
> 
> Reported-by: Steven Price <steven.price@arm.com>
> Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>

Reviewed-by: Steven Price <steven.price@arm.com>

Looks correct, although I note there is a path in
__drm_universal_plane_init() which doesn't clean up properly. I'll send
a patch for that too.

Thanks,

Steve

> ---
>  drivers/gpu/drm/arm/display/komeda/komeda_plane.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_plane.c b/drivers/gpu/drm/arm/display/komeda/komeda_plane.c
> index aa193c58f4bf6d9..517b94c3bcaf966 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_plane.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_plane.c
> @@ -279,8 +279,10 @@ static int komeda_plane_add(struct komeda_kms_dev *kms,
>  
>  	komeda_put_fourcc_list(formats);
>  
> -	if (err)
> -		goto cleanup;
> +	if (err) {
> +		kfree(kplane);
> +		return err;
> +	}
>  
>  	drm_plane_helper_add(plane, &komeda_plane_helper_funcs);
>  
> 


  reply	other threads:[~2021-12-03 10:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-30 14:25 [PATCH] drm/komeda: Fix an undefined behavior bug in komeda_plane_add() Zhou Qingyang
2021-11-30 14:25 ` Zhou Qingyang
2021-12-01 15:44 ` Steven Price
2021-12-01 15:44   ` Steven Price
2021-12-01 21:15   ` Liviu Dudau
2021-12-01 21:15     ` Liviu Dudau
2021-12-02  9:39     ` Steven Price
2021-12-02  9:39       ` Steven Price
2021-12-03 10:09       ` [PATCH] drm/komeda: return early if drm_universal_plane_init() fails Liviu Dudau
2021-12-03 10:25         ` Steven Price [this message]
2021-12-03 14:15         ` Carsten Haitzler
2021-12-03 15:02           ` Carsten Haitzler

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=15e178b3-a181-ebd6-a372-f621c8e9d2d2@arm.com \
    --to=steven.price@arm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=james.qian.wang@arm.com \
    --cc=liviu.dudau@arm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.