From patchwork Thu Jan 24 16:02:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Yasevich X-Patchwork-Id: 215402 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 2E4F62C1FC7 for ; Fri, 25 Jan 2013 03:03:29 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752667Ab3AXQD0 (ORCPT ); Thu, 24 Jan 2013 11:03:26 -0500 Received: from mail-vb0-f43.google.com ([209.85.212.43]:63817 "EHLO mail-vb0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751065Ab3AXQDY (ORCPT ); Thu, 24 Jan 2013 11:03:24 -0500 Received: by mail-vb0-f43.google.com with SMTP id fr13so3078091vbb.30 for ; Thu, 24 Jan 2013 08:03:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=iaHtXiJJmZ3nRO52UU6tJOMIGQ0CX256EBB33MIulq8=; b=Bum/P/5HpdPEOp/K+iQVBbIVou5YmjjNfWefftWVQYIrH57C8YbrAG1AOiwy84aqYj WcipihU5BYJgsUGNHFkg2BKccIC1I2l5UkrjM14frEvYQFGeu/dmyoCPkimRf6uANFZ4 JUeNeK8WT1cY+P00bXS8K/07Z6nqgOvOFZSits7lgC3r+UBi66Ec83j1MaMNytP8ergG SyLY24RLRrClbuwhwY1YhSd6Rn+06rudwB5U4yJGNSAgJ/skJH8DWDe/WarkssLALnrX s2VsEB5nSEcDRVMv3vNcWKaR95I5229vIVESv4SDbzS40dSi8KRIot67TDQUlMFjllH8 p7fA== X-Received: by 10.52.21.179 with SMTP id w19mr2138744vde.55.1359043403366; Thu, 24 Jan 2013 08:03:23 -0800 (PST) Received: from localhost.localdomain (pool-70-109-140-46.cncdnh.east.myfairpoint.net. [70.109.140.46]) by mx.google.com with ESMTPS id di16sm13477643vdb.11.2013.01.24.08.03.21 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 24 Jan 2013 08:03:22 -0800 (PST) From: Vlad Yasevich To: netdev@vger.kernel.org Cc: davem@davemloft.net, linux-sctp@vger.kernel.org, mmokrejs@fold.natur.cuni.cz, Vlad Yasevich , "Eric W. Biederman" Subject: [PATCH] SCTP: Free the per-net sysctl table on net exit. Date: Thu, 24 Jan 2013 11:02:47 -0500 Message-Id: <1359043367-30180-1-git-send-email-vyasevich@gmail.com> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: <51004F2D.9000405@fold.natur.cuni.cz> References: <51004F2D.9000405@fold.natur.cuni.cz> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Per-net sysctl table needs to be explicitly freed at net exit. Otherwise we see the following with kmemleak: unreferenced object 0xffff880402d08000 (size 2048): comm "chrome_sandbox", pid 18437, jiffies 4310887172 (age 9097.630s) hex dump (first 32 bytes): b2 68 89 81 ff ff ff ff 20 04 04 f8 01 88 ff ff .h...... ....... 04 00 00 00 a4 01 00 00 00 00 00 00 00 00 00 00 ................ backtrace: [] kmemleak_alloc+0x21/0x3e [] slab_post_alloc_hook+0x28/0x2a [] __kmalloc_track_caller+0xf1/0x104 [] kmemdup+0x1b/0x30 [] sctp_sysctl_net_register+0x1f/0x72 [] sctp_net_init+0x100/0x39f [] ops_init+0xc6/0xf5 [] setup_net+0x4c/0xd0 [] copy_net_ns+0x6d/0xd6 [] create_new_namespaces+0xd7/0x147 [] copy_namespaces+0x63/0x99 [] copy_process+0xa65/0x1233 [] do_fork+0x10b/0x271 [] sys_clone+0x23/0x25 [] stub_clone+0x13/0x20 [] 0xffffffffffffffff Reported-by: Martin Mokrejs Signed-off-by: Vlad Yasevich CC: "Eric W. Biederman" Acked-by: Neil Horman Reviewed-by: "Eric W. Biederman" --- net/sctp/sysctl.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c index 043889a..cd5712f 100644 --- a/net/sctp/sysctl.c +++ b/net/sctp/sysctl.c @@ -366,7 +366,11 @@ int sctp_sysctl_net_register(struct net *net) void sctp_sysctl_net_unregister(struct net *net) { + struct ctl_table *table; + + table = net->sctp.sysctl_hdr->ctl_table_arg; unregister_net_sysctl_table(net->sctp.sysctl_header); + kfree(table); } static struct ctl_table_header * sctp_sysctl_header;