From patchwork Thu Sep 20 12:45:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 1484971 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 497F9DF2D2 for ; Thu, 20 Sep 2012 12:45:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755109Ab2ITMpE (ORCPT ); Thu, 20 Sep 2012 08:45:04 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:59857 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754658Ab2ITMpC (ORCPT ); Thu, 20 Sep 2012 08:45:02 -0400 Received: by pbbrr4 with SMTP id rr4so129304pbb.19 for ; Thu, 20 Sep 2012 05:45:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-system-of-record; bh=D5ax9ku7HhmQDqmTYvsBe58LCd/fF/UjdPcPlcxLMF0=; b=fXWTzC0nmxbIJbRLdKzdiiQztfA70X/vI9id+kChk+cGyzbFAPf5Np37R3vidtB0nE lfs+4+lrHs28fSwSDGz3jg2CbKDNvx0S7VX9+223SrekbT/cWoelJVCE58lu8Egz6s2R FIKipUKCGoUNtci58e3q6IO1DjS62mJMG04Oif2v1d6XiLe91QIrRJoiT+RcBohGS840 SYTS49IZgrEExcXjKePXIn8ivrDRMwgEGt/0llRY5j6AuLphWOh/kGi+iJ0+HrE2DMmH 3RwlTGnonylNvLc/X5d7Ph9ksp5VfAgHInSi1I28ltNHyAhxJjif8lM1AriCaVrZeP1T FIPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-system-of-record:x-gm-message-state; bh=D5ax9ku7HhmQDqmTYvsBe58LCd/fF/UjdPcPlcxLMF0=; b=FgNjyIDg/adPRraXq7o289yW8/tAWiwzKQDWfSbTRN/fLXAmaAlqjnJ0Sztz2gvYMv 8U/86ko373PFmxVCc279o/Mbhx+XxRLXGF2rYis2kNXVyAfGiDiOzeMXHoKDhd85h9tg T6/oVLfFGn9gIrqUbckpWhMGSmvueaD04Hp/7j7sMvBlb5CfrGVOzOoZjaEwMWzrvY2n AiaYd60uB4O024eL3ulhx94Mxu+n3fqH2sKChcUc0YxbIrLjgjdGgWyTQNXaqYC690QN utLzULMSEByeIZvIb6PE9J9nCWUg3Wa4BNgOBVl+hVKxvkRGJfhDJu6qJy7pqn9pRymy M2Qw== Received: by 10.66.90.67 with SMTP id bu3mr5106520pab.26.1348145101807; Thu, 20 Sep 2012 05:45:01 -0700 (PDT) MIME-Version: 1.0 Received: by 10.66.90.67 with SMTP id bu3mr5106503pab.26.1348145101618; Thu, 20 Sep 2012 05:45:01 -0700 (PDT) Received: by 10.68.33.193 with HTTP; Thu, 20 Sep 2012 05:45:01 -0700 (PDT) In-Reply-To: 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> Date: Thu, 20 Sep 2012 14:45:01 +0200 Message-ID: Subject: Re: regression: tethering fails in 3.5 with iwlwifi From: Eric Dumazet To: Johannes Berg Cc: artem.bityutskiy@linux.intel.com, linux-wireless@vger.kernel.org, netdev X-System-Of-Record: true X-Gm-Message-State: ALoCoQmL3DOyRgGx2LznMpyLlrNvGTq5dCQV6u/layo/iJKAEU2154tppJtd/h2u7ydo1xPg33lN679Qviy/z5moT2+kOv8W0OEHVLd8EOew8mgGAmNE4Trww5bz8HOcFAnxTMoUmnUceB3LeZzW/tJsImLgymiKpq+DovN0ixd9PvLplXo13EGMP4oFn2bhFafigS9VPt6iu+SI2aLkqOo5TwPCl+7+pQ== Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org I guess you only need to make sure 14 bytes of ethernet header are available before eth_type_trans(skb, dev); On Thu, Sep 20, 2012 at 2:40 PM, Eric Dumazet wrote: > OK, but which netif_receive_skb(), as I count 5 occurrences in > net/mac80211/rx.c ? > > Instead of skb_linearize() calls > > you could try several values of XXX in > > pskb_may_pull(skb, XXX) > > So that you make sure XXX bytes are available in skb->head, and not > the whole frame. > > One you know the limit for XXX, it might give a clue where a > pskb_may_pull(skb, XXX) is missing. > > On Thu, Sep 20, 2012 at 2:35 PM, Johannes Berg > wrote: >> Hi, >> >>> > 56138f5 iwlwifi: dont pull too much payload in skb head >>> > 3edaf3e mac80211: manage AP netdev carrier state >>> >>> The second patch (AP carrier state) actually exposed a connman issue >>> which I fixed and submitted a connman patch: >>> http://lists.connman.net/pipermail/connman/2012-September/011232.html >>> >>> However, Eric's patch still causes tethering problems to me. >> >> >> Let me recap a bit. Artem is using connman, which sets up the wifi >> interface as part of a bridge. It runs wpa_supplicant to create an AP >> (only AP and mesh mode interfaces can be bridged anyway). >> >> >> Eric, you said: >> >>> I would say some part of the stack assumes a header (I dont know wich >>> one ?) is pulled in skb->head/data, and thats a bug. >>> >>> Always use pskb_may_pull(skb, XXX) to make sure you can access XXX >>> bytes in skb->data >> >> I thought we'd figure out which part of the stack assumes a header, so I >> asked Artem to test a one-line patch which adds "skb_linearize()" before >> "netif_receive_skb()" in mac80211. This makes it work, but I'm not sure >> where after that the bad assumption might be. >> >> johannes >> --- 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/mac80211/rx.c b/net/mac80211/rx.c index 61c621e..ffe5f84 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -1795,9 +1795,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, sizeof(struct ethhdr))) { + skb->protocol = eth_type_trans(skb, dev); + memset(skb->cb, 0, sizeof(skb->cb)); + netif_receive_skb(skb); + } else { + kfree_skb(skb); + } } }