From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cong Wang Subject: Re: new kmemleak reports (was: Re: [PATCH 0/5] genetlink improvements) Date: Wed, 2 Nov 2016 13:30:34 -0700 Message-ID: References: <1477312805-7110-1-git-send-email-johannes@sipsolutions.net> <20161101172840.6d7d6278@jkicinski-Precision-T1700> <20161101185630.3c7d326f@jkicinski-Precision-T1700> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Cc: Johannes Berg , Dmitry Torokhov , =?UTF-8?Q?Maciej_=C5=BBenczykowski?= , Linux Kernel Network Developers To: Jakub Kicinski Return-path: Received: from mail-oi0-f68.google.com ([209.85.218.68]:34243 "EHLO mail-oi0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756148AbcKBUaz (ORCPT ); Wed, 2 Nov 2016 16:30:55 -0400 Received: by mail-oi0-f68.google.com with SMTP id 62so2859851oif.1 for ; Wed, 02 Nov 2016 13:30:55 -0700 (PDT) In-Reply-To: <20161101185630.3c7d326f@jkicinski-Precision-T1700> Sender: netdev-owner@vger.kernel.org List-ID: On Tue, Nov 1, 2016 at 11:56 AM, Jakub Kicinski wrote: > On Tue, 1 Nov 2016 11:32:52 -0700, Cong Wang wrote: >> On Tue, Nov 1, 2016 at 10:28 AM, Jakub Kicinski wrote: >> > unreferenced object 0xffff8807389cba28 (size 128): >> > comm "swapper/0", pid 1, jiffies 4294898463 (age 781.332s) >> > hex dump (first 32 bytes): >> > 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk >> > 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk >> > backtrace: >> > [] kmemleak_alloc+0x28/0x50 >> > [] __kmalloc+0x206/0x5a0 >> > [] genl_register_family+0x711/0x11d0 >> > [] netlbl_mgmt_genl_init+0x10/0x12 >> > [] netlbl_netlink_init+0x9/0x26 >> > [] netlbl_init+0x4f/0x85 >> > [] do_one_initcall+0xb7/0x2a0 >> > [] kernel_init_freeable+0x597/0x636 >> > [] kernel_init+0x13/0x140 >> > [] ret_from_fork+0x2a/0x40 >> >> Looks like we are missing a kfree(family->attrbuf); on error path, >> but it is not related to Johannes' recent patches. >> >> Could the attached patch help? >> >> Thanks. > > Still there: > > unreferenced object 0xffff88073fb204e8 (size 64): > comm "swapper/0", pid 1, jiffies 4294898455 (age 88.528s) > hex dump (first 32 bytes): > 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk > 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk > backtrace: > [] kmemleak_alloc+0x28/0x50 > [] __kmalloc+0x206/0x5a0 > [] genl_register_family+0x921/0x1270 > [] genl_init+0x11/0x43 > [] do_one_initcall+0xb7/0x2a0 > [] kernel_init_freeable+0x597/0x636 > [] kernel_init+0x13/0x140 > [] ret_from_fork+0x2a/0x40 > [] 0xffffffffffffffff > > etc. Interesting, from the size it does look like we are leaking family->attrbuf, but I don't see other cases could leak it except the error path I fixed. Mind doing a quick bisect? Thanks!