From patchwork Mon Jul 3 17:06:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Valentin X-Patchwork-Id: 783582 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 3x1YV42JTvz9s76 for ; Tue, 4 Jul 2017 03:07:40 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amazon.com header.i=@amazon.com header.b="j/yN7Eii"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755261AbdGCRHb (ORCPT ); Mon, 3 Jul 2017 13:07:31 -0400 Received: from smtp-fw-6001.amazon.com ([52.95.48.154]:50269 "EHLO smtp-fw-6001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755236AbdGCRH3 (ORCPT ); Mon, 3 Jul 2017 13:07:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1499101649; x=1530637649; h=from:to:cc:subject:date:message-id:mime-version; bh=t8VFVmKrPIdJotZvRHa+Pcg1DH3DN+l1+YuQhk3ZmWM=; b=j/yN7EiimBnbr7Z31b354Sc4MnQb3V3vljLr+BlxSSLWKU+IKOrr6fDi LbcbYiFm50YEIVTunniHxEVmCHo8BOANHFiUBtxvXrhD5goCt9ineONc3 Z8rCLRvpHjNoGSl1hu7i9syhorsROskx4CEl0XSEEjRyakwO/VLmwZQtI A=; X-IronPort-AV: E=Sophos;i="5.40,304,1496102400"; d="scan'208";a="296189032" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-71008.iad55.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-6001.iad6.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 03 Jul 2017 17:07:21 +0000 Received: from EX13MTAUWB001.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan2.iad.amazon.com [10.40.159.162]) by email-inbound-relay-71008.iad55.amazon.com (8.14.7/8.14.7) with ESMTP id v63H7JeT016707 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Mon, 3 Jul 2017 17:07:19 GMT Received: from EX13D05UWB004.ant.amazon.com (10.43.161.208) by EX13MTAUWB001.ant.amazon.com (10.43.161.249) with Microsoft SMTP Server (TLS) id 15.0.1104.5; Mon, 3 Jul 2017 17:07:19 +0000 Received: from EX13MTAUEB001.ant.amazon.com (10.43.60.96) by EX13D05UWB004.ant.amazon.com (10.43.161.208) with Microsoft SMTP Server (TLS) id 15.0.1104.5; Mon, 3 Jul 2017 17:07:19 +0000 Received: from localhost (10.85.219.125) by mail-relay.amazon.com (10.43.60.129) with Microsoft SMTP Server id 15.0.1104.5 via Frontend Transport; Mon, 3 Jul 2017 17:07:18 +0000 From: Eduardo Valentin To: Stephen Hemminger , "David S . Miller" CC: , , , Eduardo Valentin , "stable # v4 . 9+" Subject: [PATCH 1/1] bridge: mdb: report complete_info ptr as not a kmemleak Date: Mon, 3 Jul 2017 10:06:34 -0700 Message-ID: <1499101594-22421-1-git-send-email-eduval@amazon.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org We currently get the following kmemleak report: unreferenced object 0xffff8800039d9820 (size 32): comm "softirq", pid 0, jiffies 4295212383 (age 792.416s) hex dump (first 32 bytes): 00 0c e0 03 00 88 ff ff ff 02 00 00 00 00 00 00 ................ 00 00 00 01 ff 11 00 02 86 dd 00 00 ff ff ff ff ................ backtrace: [] kmemleak_alloc+0x4a/0xa0 [] kmem_cache_alloc_trace+0xb8/0x1c0 [] __br_mdb_notify+0x2a3/0x300 [bridge] [] br_mdb_notify+0x6e/0x70 [bridge] [] br_multicast_add_group+0x109/0x150 [bridge] [] br_ip6_multicast_add_group+0x58/0x60 [bridge] [] br_multicast_rcv+0x1d5/0xdb0 [bridge] [] br_handle_frame_finish+0xcf/0x510 [bridge] [] br_nf_hook_thresh.part.27+0xb/0x10 [br_netfilter] [] br_nf_hook_thresh+0x48/0xb0 [br_netfilter] [] br_nf_pre_routing_finish_ipv6+0x109/0x1d0 [br_netfilter] [] br_nf_pre_routing_ipv6+0xd0/0x14c [br_netfilter] [] br_nf_pre_routing+0x197/0x3d0 [br_netfilter] [] nf_iterate+0x52/0x60 [] nf_hook_slow+0x5c/0xb0 [] br_handle_frame+0x1a4/0x2c0 [bridge] This patch flags the complete_info ptr object as not a leak as it will get freed when .complete_priv() is called, for the br mdb case, it will be freed at br_mdb_complete(). Cc: stable # v4.9+ Reviewed-by: Vallish Vaidyeshwara Signed-off-by: Eduardo Valentin --- net/bridge/br_mdb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c index b084548..1c81546 100644 --- a/net/bridge/br_mdb.c +++ b/net/bridge/br_mdb.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -319,6 +320,8 @@ static void __br_mdb_notify(struct net_device *dev, struct net_bridge_port *p, if (port_dev && type == RTM_NEWMDB) { complete_info = kmalloc(sizeof(*complete_info), GFP_ATOMIC); if (complete_info) { + /* This pointer is freed in br_mdb_complete() */ + kmemleak_not_leak(complete_info); complete_info->port = p; __mdb_entry_to_br_ip(entry, &complete_info->ip); mdb.obj.complete_priv = complete_info;