mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Cc: David Airlie <airlied@linux.ie>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm: fb: cma: fix memory leak
Date: Mon, 13 Jun 2016 09:52:49 +0200	[thread overview]
Message-ID: <20160613075249.GP3363@phenom.ffwll.local> (raw)
In-Reply-To: <1465743836-6228-1-git-send-email-sudipm.mukherjee@gmail.com>

On Sun, Jun 12, 2016 at 04:03:56PM +0100, Sudip Mukherjee wrote:
> We may have a situation that the memory allocation for fbdefio fails
> and then the allocation for fbops may succeed as some memory has been
> freed somewhere. Lets free fbops also to face these rare situtation.
> Since kfree can handle arguments as NULL, there should not be any
> problem in calling both the kfree().
> 
> Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>

Thanks for the patch, applied to drm-misc. For next time around please
figure out which patch created the broken using git blame. Then cite
that in your commit message and cc the author/reviewers of the broken
commit when submitting your fix.
-Daniel

> ---
>  drivers/gpu/drm/drm_fb_cma_helper.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c
> index 2e7ef0b..c0b0c71 100644
> --- a/drivers/gpu/drm/drm_fb_cma_helper.c
> +++ b/drivers/gpu/drm/drm_fb_cma_helper.c
> @@ -346,6 +346,7 @@ static int drm_fbdev_cma_defio_init(struct fb_info *fbi,
>  	fbops = kzalloc(sizeof(*fbops), GFP_KERNEL);
>  	if (!fbdefio || !fbops) {
>  		kfree(fbdefio);
> +		kfree(fbops);
>  		return -ENOMEM;
>  	}
>  
> -- 
> 1.9.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

      reply	other threads:[~2016-06-13  7:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-12 15:03 Sudip Mukherjee
2016-06-13  7:52 ` Daniel Vetter [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=20160613075249.GP3363@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sudipm.mukherjee@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

Powered by JetHome