linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
To: David Airlie <airlied@linux.ie>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	patrik.r.jakobsson@gmail.com
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v3] drm/gma500: fix double freeing
Date: Wed, 9 Dec 2015 17:23:04 +0530	[thread overview]
Message-ID: <20151209115304.GC24852@sudip-pc> (raw)
In-Reply-To: <1444308468-8910-1-git-send-email-sudipm.mukherjee@gmail.com>

On Thu, Oct 08, 2015 at 06:17:48PM +0530, Sudip Mukherjee wrote:
> We are allocating backing using psbfb_alloc() and so
> backing->stolen is always true. So we were freeing backing two times.
> Moreover if we follow the execution path then we should be freeing
> backing after we have released the helper. So remove the one which frees
> backing before the helper is released.
> While at it the error labels are also renamed to give a meaningful
> name.
> 
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> Reviewed-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
> ---

This patch was never picked up. It will not apply now.

Daniel, please let me know if you want me to resend after making
necessary changes.

regards
sudip

>  drivers/gpu/drm/gma500/framebuffer.c | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/gma500/framebuffer.c b/drivers/gpu/drm/gma500/framebuffer.c
> index 2eaf1b3..52e2bf3 100644
> --- a/drivers/gpu/drm/gma500/framebuffer.c
> +++ b/drivers/gpu/drm/gma500/framebuffer.c
> @@ -411,7 +411,7 @@ static int psbfb_create(struct psb_fbdev *fbdev,
>  	info = drm_fb_helper_alloc_fbi(&fbdev->psb_fb_helper);
>  	if (IS_ERR(info)) {
>  		ret = PTR_ERR(info);
> -		goto out_err1;
> +		goto err_unlock;
>  	}
>  	info->par = fbdev;
>  
> @@ -419,7 +419,7 @@ static int psbfb_create(struct psb_fbdev *fbdev,
>  
>  	ret = psb_framebuffer_init(dev, psbfb, &mode_cmd, backing);
>  	if (ret)
> -		goto out_unref;
> +		goto err_release;
>  
>  	fb = &psbfb->base;
>  	psbfb->fbdev = info;
> @@ -465,14 +465,9 @@ static int psbfb_create(struct psb_fbdev *fbdev,
>  
>  	mutex_unlock(&dev->struct_mutex);
>  	return 0;
> -out_unref:
> -	if (backing->stolen)
> -		psb_gtt_free_range(dev, backing);
> -	else
> -		drm_gem_object_unreference(&backing->gem);
> -
> +err_release:
>  	drm_fb_helper_release_fbi(&fbdev->psb_fb_helper);
> -out_err1:
> +err_unlock:
>  	mutex_unlock(&dev->struct_mutex);
>  	psb_gtt_free_range(dev, backing);
>  	return ret;
> -- 
> 1.9.1
> 

  reply	other threads:[~2015-12-09 11:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-06 15:48 [PATCH v2] drm/gma500: fix double freeing Sudip Mukherjee
2015-10-07 20:55 ` Patrik Jakobsson
2015-10-08 12:47 ` [PATCH v3] " Sudip Mukherjee
2015-12-09 11:53   ` Sudip Mukherjee [this message]
2015-12-09 12:20     ` Patrik Jakobsson
2016-04-07 15:52       ` Sudip Mukherjee
2016-04-07 17:20         ` Patrik Jakobsson

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=20151209115304.GC24852@sudip-pc \
    --to=sudipm.mukherjee@gmail.com \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patrik.r.jakobsson@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).