From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965080AbcFMHwz (ORCPT ); Mon, 13 Jun 2016 03:52:55 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:33323 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964891AbcFMHwy (ORCPT ); Mon, 13 Jun 2016 03:52:54 -0400 Date: Mon, 13 Jun 2016 09:52:49 +0200 From: Daniel Vetter To: Sudip Mukherjee Cc: David Airlie , Daniel Vetter , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH] drm: fb: cma: fix memory leak Message-ID: <20160613075249.GP3363@phenom.ffwll.local> Mail-Followup-To: Sudip Mukherjee , David Airlie , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org References: <1465743836-6228-1-git-send-email-sudipm.mukherjee@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1465743836-6228-1-git-send-email-sudipm.mukherjee@gmail.com> X-Operating-System: Linux phenom 4.6.0-rc5+ User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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