Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755537AbbFLPlB (ORCPT ); Fri, 12 Jun 2015 11:41:01 -0400 Received: from mail-vn0-f41.google.com ([209.85.216.41]:44554 "EHLO mail-vn0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751130AbbFLPko (ORCPT ); Fri, 12 Jun 2015 11:40:44 -0400 MIME-Version: 1.0 In-Reply-To: <1434010476-3406-1-git-send-email-dongxing.zhang@intel.com> References: <1434010476-3406-1-git-send-email-dongxing.zhang@intel.com> Date: Fri, 12 Jun 2015 16:40:43 +0100 Message-ID: Subject: Re: [PATCH] drm/nouveau: fix memory leak by deallocating cli/drm From: Emil Velikov To: Dongxing Zhang Cc: David Airlie , Ben Skeggs , Dave Airlie , Thierry Reding , Alexandre Courbot , ML dri-devel , "Linux-Kernel@Vger. Kernel. Org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2417 Lines: 56 Hi Dongxing Zhang, On 11 June 2015 at 09:14, Dongxing Zhang wrote: > unreferenced object 0xffff8800bd132fe8 (size 256): > comm "Xorg", pid 1260, jiffies 4294901661 (age 660.504s) > hex dump (first 32 bytes): > 00 00 00 00 00 00 00 00 e8 2f 13 bd 00 88 ff ff ........./...... > 01 00 00 00 ff ff ff ff 00 00 00 00 00 00 00 00 ................ > backtrace: > [] kmemleak_alloc+0x4e/0xb0 > [] __kmalloc+0x204/0x2c0 > [] nouveau_cli_create+0x2a/0xb0 [nouveau] > [] nouveau_drm_open+0xcb/0x220 [nouveau] > [] drm_open+0x1b2/0x4d0 [drm] > [] drm_stub_open+0xa9/0x130 [drm] > [] chrdev_open+0x9f/0x1d0 > [] do_dentry_open+0x257/0x350 > [] vfs_open+0x49/0x50 > [] do_last+0x1ec/0x1200 > [] path_openat+0x80/0x600 > [] do_filp_open+0x3a/0x90 > [] do_sys_open+0x128/0x220 > [] SyS_open+0x1e/0x20 > [] system_call_fastpath+0x16/0x75 > [] 0xffffffffffffffff > > Signed-off-by: Dongxing Zhang A similar patch has been picked up recently [1] [1] http://lists.freedesktop.org/archives/dri-devel/2015-June/084249.html > --- > drivers/gpu/drm/nouveau/nouveau_drm.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c > index 8904933..2ead477 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_drm.c > +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c > @@ -115,7 +115,8 @@ nouveau_cli_create(u64 name, const char *sname, > if (ret == 0) { > mutex_init(&cli->mutex); > usif_client_init(cli); > - } > + } else > + kfree(cli); ... although it's missing this hunk. Iirc at this level the destructor is not implicitly called so this is required. Cheers Emil -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/