From patchwork Fri Jun 3 20:07:38 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Bohac X-Patchwork-Id: 98647 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 A6216B6FB2 for ; Sat, 4 Jun 2011 06:08:02 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756050Ab1FCUHl (ORCPT ); Fri, 3 Jun 2011 16:07:41 -0400 Received: from cantor.suse.de ([195.135.220.2]:49485 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756046Ab1FCUHk (ORCPT ); Fri, 3 Jun 2011 16:07:40 -0400 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id 59B1093F19; Fri, 3 Jun 2011 22:07:39 +0200 (CEST) Date: Fri, 3 Jun 2011 22:07:38 +0200 From: Jiri Bohac To: Patrick McHardy , "David S. Miller" , netdev@vger.kernel.org Cc: Pedro Garcia Subject: [PATCH 1/2] vlan: only create special VLAN 0 once Message-ID: <20110603200738.GA24804@midget.suse.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Commit ad1afb00 registers a VLAN with vid == 0 for every device to handle 802.1p frames. This is currently done on every NETDEV_UP event and the special vlan is never unregistered. This may have strange effects on drivers implementning ndo_vlan_rx_add_vid(). E.g. bonding will allocate a linked-list element each time, causing a memory leak. Only register the special VLAN once on NETDEV_REGISTER. Signed-off-by: Jiri Bohac diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index c7a581a..bf89565 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c @@ -371,7 +371,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event, if (is_vlan_dev(dev)) __vlan_device_event(dev, event); - if ((event == NETDEV_UP) && + if ((event == NETDEV_REGISTER) && (dev->features & NETIF_F_HW_VLAN_FILTER) && dev->netdev_ops->ndo_vlan_rx_add_vid) { pr_info("8021q: adding VLAN 0 to HW filter on device %s\n",