From patchwork Thu Sep 20 14:25:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 1485261 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 2886DDF2D2 for ; Thu, 20 Sep 2012 14:26:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755798Ab2ITO0K (ORCPT ); Thu, 20 Sep 2012 10:26:10 -0400 Received: from mail-bk0-f46.google.com ([209.85.214.46]:34315 "EHLO mail-bk0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755741Ab2ITOZy (ORCPT ); Thu, 20 Sep 2012 10:25:54 -0400 Received: by bkuw11 with SMTP id w11so255631bku.19 for ; Thu, 20 Sep 2012 07:25:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:from:to:cc:in-reply-to:references:content-type:date :message-id:mime-version:x-mailer:content-transfer-encoding; bh=Tq/LeTQsXexRquVhXOEJuFQYleZeWsFZf5onJacviIA=; b=Bf/qHS2idcOqkk87YVawJOMnNpevyaLm0wAukiyCDxSTu8dA2SvlVyHmCbuMKciuOZ NSo4Lo7mGQVo7og1ErYyCXR9cmtuCKHE4smZ6XyzM94QKOg+iQecsm94qhOq+pD+EMUi iXMdl5jo0Aevb5ZVd+UEqEOoDXwE6t3cMHuB6zvimdkHcGFHbcw/dbAKJzYLrbSMO3JC l4XWAPi4k7e721AI0FdKah8XwJtBw9USnqKTXWi/vT1XiVU4wiE473Q+/bzSiffBsd43 GN8XEMISTlWxuX4paFrlvgLdGnsikeoh22M7kBc2ybyHLnpMFE2CnLaR/Od8kjikutJs pbtg== Received: by 10.205.120.16 with SMTP id fw16mr748462bkc.102.1348151153141; Thu, 20 Sep 2012 07:25:53 -0700 (PDT) Received: from [172.28.91.176] ([172.28.91.176]) by mx.google.com with ESMTPS id t23sm4461379bks.4.2012.09.20.07.25.50 (version=SSLv3 cipher=OTHER); Thu, 20 Sep 2012 07:25:51 -0700 (PDT) Subject: Re: regression: tethering fails in 3.5 with iwlwifi From: Eric Dumazet To: artem.bityutskiy@linux.intel.com Cc: Eric Dumazet , Johannes Berg , linux-wireless@vger.kernel.org, netdev In-Reply-To: <1348147353.2388.19.camel@sauron.fi.intel.com> References: <1347361823.26457.3.camel@sauron.fi.intel.com> <1DC40B07CD6EC041A66726C271A73AE6195AE9C8@IRSMSX102.ger.corp.intel.com> <1347631355.5263.19.camel@sauron.fi.intel.com> <1347640763.5263.24.camel@sauron.fi.intel.com> <1347892887.7112.9.camel@sauron.fi.intel.com> <1348142775.2388.10.camel@sauron.fi.intel.com> <1348144524.4161.26.camel@jlt4.sipsolutions.net> <1348145936.2388.18.camel@sauron.fi.intel.com> <1348147353.2388.19.camel@sauron.fi.intel.com> Date: Thu, 20 Sep 2012 16:25:49 +0200 Message-ID: <1348151149.31352.109.camel@edumazet-glaptop> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Thu, 2012-09-20 at 16:22 +0300, Artem Bityutskiy wrote: > On Thu, 2012-09-20 at 15:04 +0200, Eric Dumazet wrote: > > Try to pull 40 bytes : Thats OK for tcp performance, because 40 bytes > > is the minimum size of IP+TCP headers > > > > pskb_may_pull(skb, 40); > > OK, I've tried almost this (see below) and it solves my issue: > > diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c > index 965e6ec..7f079d0 100644 > --- a/net/mac80211/rx.c > +++ b/net/mac80211/rx.c > @@ -1798,9 +1798,13 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx) > > if (skb) { > /* deliver to local stack */ > - skb->protocol = eth_type_trans(skb, dev); > - memset(skb->cb, 0, sizeof(skb->cb)); > - netif_receive_skb(skb); > + if (pskb_may_pull(skb, 40)) { > + skb->protocol = eth_type_trans(skb, dev); > + memset(skb->cb, 0, sizeof(skb->cb)); > + netif_receive_skb(skb); > + } else { > + kfree_skb(skb); > + } > } > } > Please remove this hack and try the following bugfix in raw handler icmp_filter() should not modify skb, or else its caller should not assume ip_hdr() is unchanged. net/ipv4/raw.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) --- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index f242578..3fa8c96 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c @@ -128,25 +128,30 @@ found: } /* - * 0 - deliver - * 1 - block + * false - deliver + * true - block */ -static __inline__ int icmp_filter(struct sock *sk, struct sk_buff *skb) +static bool icmp_filter(struct sock *sk, const struct sk_buff *skb) { - int type; - - if (!pskb_may_pull(skb, sizeof(struct icmphdr))) - return 1; - - type = icmp_hdr(skb)->type; - if (type < 32) { + __u8 _type; + const __u8 *type; + + type = skb_header_pointer(skb, + skb_transport_offset(skb) + + offsetof(struct icmphdr, type), + sizeof(_type), + &_type); + if (!type) + return true; + + if (*type < 32) { __u32 data = raw_sk(sk)->filter.data; - return ((1 << type) & data) != 0; + return ((1U << *type) & data) != 0; } /* Do not block unknown ICMP types */ - return 0; + return false; } /* IP input processing comes here for RAW socket delivery.