From patchwork Tue Dec 7 21:03:12 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 74596 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 A9EB5B6F1E for ; Wed, 8 Dec 2010 08:03:41 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755127Ab0LGVDg (ORCPT ); Tue, 7 Dec 2010 16:03:36 -0500 Received: from kroah.org ([198.145.64.141]:48468 "EHLO coco.kroah.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754665Ab0LGVDf (ORCPT ); Tue, 7 Dec 2010 16:03:35 -0500 Received: from localhost (c-71-227-141-191.hsd1.wa.comcast.net [71.227.141.191]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by coco.kroah.org (Postfix) with ESMTPSA id 8F444105B4; Tue, 7 Dec 2010 13:03:34 -0800 (PST) Date: Tue, 7 Dec 2010 13:03:12 -0800 From: Greg KH To: Eric Dumazet Cc: netdev@vger.kernel.org, Jesse Gross , stable@kernel.org, David Miller Subject: Re: [stable] [PATCH 2.6.36 stable] vlan: Avoid hwaccel vlan packets when vid not used. Message-ID: <20101207210312.GA14729@kroah.com> References: <1289251381-6671-1-git-send-email-jesse@nicira.com> <20101207195019.GP13189@kroah.com> <1291755026.5324.3.camel@edumazet-laptop> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1291755026.5324.3.camel@edumazet-laptop> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, Dec 07, 2010 at 09:50:26PM +0100, Eric Dumazet wrote: > Le mardi 07 décembre 2010 à 11:50 -0800, Greg KH a écrit : > > On Mon, Nov 08, 2010 at 01:23:01PM -0800, Jesse Gross wrote: > > > Normally hardware accelerated vlan packets are quickly dropped if > > > there is no corresponding vlan device configured. The one exception > > > is promiscuous mode, where we allow all of these packets through so > > > they can be picked up by tcpdump. However, this behavior causes a > > > crash if we actually try to receive these packets. This fixes that > > > crash by ignoring packets with vids not corresponding to a configured > > > device in the vlan hwaccel routines and then dropping them before they > > > get to consumers in the network stack. > > > > > > This patch applies only to 2.6.36 stable. The problem was introduced > > > in that release and is already fixed by larger changes to the vlan > > > code in 2.6.37. > > > > Applied, thanks. > > > > Oh well, which version ? > > A new version of the patch was submitted 6 days ago . > > http://patchwork.ozlabs.org/patch/73791/ I applied the one below. If that is incorrect, please send me the correct one. thanks, greg k-h From jesse@nicira.com Tue Dec 7 11:49:39 2010 From: Jesse Gross Date: Mon, 8 Nov 2010 13:23:01 -0800 Subject: [stable] [PATCH 2.6.36 stable] vlan: Avoid hwaccel vlan packets when vid not used. To: stable@kernel.org Cc: netdev@vger.kernel.org, David Miller Message-ID: <1289251381-6671-1-git-send-email-jesse@nicira.com> From: Jesse Gross [This patch applies only to 2.6.36 stable. The problem was introduced in that release and is already fixed by larger changes to the vlan code in 2.6.37.] Normally hardware accelerated vlan packets are quickly dropped if there is no corresponding vlan device configured. The one exception is promiscuous mode, where we allow all of these packets through so they can be picked up by tcpdump. However, this behavior causes a crash if we actually try to receive these packets. This fixes that crash by ignoring packets with vids not corresponding to a configured device in the vlan hwaccel routines and then dropping them before they get to consumers in the network stack. Reported-by: Ben Greear Tested-by: Nikola Ciprich Signed-off-by: Jesse Gross Acked-by: David Miller Signed-off-by: Greg Kroah-Hartman --- net/8021q/vlan_core.c | 3 +++ net/core/dev.c | 13 +++++++++++++ 2 files changed, 16 insertions(+) --- a/net/8021q/vlan_core.c +++ b/net/8021q/vlan_core.c @@ -43,6 +43,9 @@ int vlan_hwaccel_do_receive(struct sk_bu struct net_device *dev = skb->dev; struct vlan_rx_stats *rx_stats; + if (unlikely(!is_vlan_dev(dev))) + return 0; + skb->dev = vlan_dev_info(dev)->real_dev; netif_nit_deliver(skb); --- a/net/core/dev.c +++ b/net/core/dev.c @@ -2891,6 +2891,19 @@ static int __netif_receive_skb(struct sk ncls: #endif + /* If we got this far with a hardware accelerated VLAN tag, it means + * that we were put in promiscuous mode but nobody is interested in + * this vid. Drop the packet now to prevent it from getting propagated + * to other parts of the stack that won't know how to deal with packets + * tagged in this manner. + */ + if (unlikely(vlan_tx_tag_present(skb))) { + if (pt_prev) + ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev); + kfree_skb(skb); + goto out; + } + /* Handle special case of bridge or macvlan */ rx_handler = rcu_dereference(skb->dev->rx_handler); if (rx_handler) {