From patchwork Tue Dec 6 12:23:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cedric Izoard X-Patchwork-Id: 9462507 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 43AF060231 for ; Tue, 6 Dec 2016 12:47:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 37BE227569 for ; Tue, 6 Dec 2016 12:47:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 294EC27CAF; Tue, 6 Dec 2016 12:47:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5395327569 for ; Tue, 6 Dec 2016 12:47:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753253AbcLFMpp convert rfc822-to-8bit (ORCPT ); Tue, 6 Dec 2016 07:45:45 -0500 Received: from sbg-il.ceva-dsp.com ([195.82.128.8]:52868 "EHLO sbg-il.ceva-dsp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751610AbcLFMkL (ORCPT ); Tue, 6 Dec 2016 07:40:11 -0500 X-Greylist: delayed 972 seconds by postgrey-1.27 at vger.kernel.org; Tue, 06 Dec 2016 07:40:10 EST X-AuditID: ac181808-4b5ff70000000a72-14-5846adb09f37 Received: from mail.ceva-dsp.com (mail-il2.corp.local [192.168.61.12]) by sbg-il.ceva-dsp.com (CEVA eMail Gateway) with SMTP id F4.2C.02674.0BDA6485; Tue, 6 Dec 2016 14:23:15 +0200 (IST) Received: from Mail-IL2.corp.local (192.168.61.12) by Mail-IL2.corp.local (192.168.61.12) with Microsoft SMTP Server (TLS) id 15.1.466.34; Tue, 6 Dec 2016 14:23:28 +0200 Received: from Mail-IL2.corp.local ([192.168.61.12]) by Mail-IL2.corp.local ([192.168.61.12]) with mapi id 15.01.0466.037; Tue, 6 Dec 2016 14:23:28 +0200 From: Cedric Izoard To: "linux-wireless@vger.kernel.org" CC: Laurent Trarieux Subject: [PATCH] mac80211: Ensure enough headroom when forwarding mesh pkt Thread-Topic: [PATCH] mac80211: Ensure enough headroom when forwarding mesh pkt Thread-Index: AdJPulNLksgnjs4/SeuvZ8hADv7i9w== Date: Tue, 6 Dec 2016 12:23:28 +0000 Message-ID: <356db1fcf788467f9145abc10e218d66@ceva-dsp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [192.168.61.51] x-tm-as-product-ver: SMEX-12.0.0.1220-8.000.1202-22744.003 x-tm-as-result: No--0.621200-8.000000-31 x-tm-as-matchedid: 701625-704425-700685-703788-390492-700486-186003-700270-1 88019-700625-707057-700057-707119-702688-148004-148133-42000-42003 x-tm-as-user-approved-sender: No x-tm-as-user-blocked-sender: No MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA12TWUwTURSGvdOhHaCjw7BdimwTjEYWUSAIimIUMMYHCTESXuoAI20obe1M EfSFsIiSuKC4sC8RRFlkiZHgBjVGJYBiiIBKYgIGEAIpEo1BjTNMwcLbf/9z/nO/O/cOJiHb ZApMreUYg5bWUFI7tLshUh7Q0RyTEDQ27r57tuGzLAoc/t7ueQwk2u9NormMeHWqdse+k/aq yYkFG/2SNPNB4wskG3yxKQS2GCRCYO7lYqQQ2GEk8RTA8vY6mbhoBrBkdB6IizIA52/NoUJE SgTBnt73EkE7EdHwRlvHspbwo7Jrc6SCdiSOwE81l2zEnjhYN2xGRR0Ix6taljVK+MIOUyUQ NE7sgfN5RYigAeECf/Y2IeJMV/hxogoRUQl458lbiaid4fT4X8sRfGDXeTPvY7yOgOayaNHe Bgfr6pZPBokiAAeXLsrEgjcceNgnFbUXfD5dbOH3h9WPF6Si9oP1NTMSkc0BvimZQK8Ct1Ir pFKrSKlVpNQqUg3Q+8CRTUoNUGsCk5kMOiCF1Qcm69LbAX9zTRBinWCxK8IECAxQcpzLi04g begMNivdBMIxhHLGfcNjEsiNSbqULBXNqpQGo4ZhKU+cTuNt11WbNbJ6dbJaZ2SVRoPGBCAm oZzwmSa+CU+hs84yBp0YNQF3DKVccXKpOI4kUmmOSWMYPWNYqe7HMArim4Sgg4FJZTJPqTXc SpnywQuEfRXWlfVbI5itsL+dwolltCmMgTZyKqXwDJUs/w5NIAyT82inl9FYPZ3Ou5bpHviw MN1lxV07uRfEYt3zDV8REtXqtIzCFa9t5LsJoVtl1K5CKrxx3ZaQBNLNqrB20jcQyn9tR7xR YJDzv9J/hM34LwHB2WKuz4XxV+KEv351UGDnaM6avV9kt7hrk4psQDhHXwkuKGkNuf4ufLiS y/9QlB8Xama6bOOSO2U375pHt+aUx/6Yzck9MVDQbwp1G/HbpexBRlojF88dYMI8hsgbU1H1 9w55pJ+ZuxbsUnG0zKdi0kMeMoappxJd4tvHvfR+07c9/8yxLzc86vldHXVc2VrofyGvVR48 1Ec/aymnUFZF79wuMbD0P3NpwK9EBAAA Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When a buffer is duplicated during MESH packet forwarding, this patch ensures that the new buffer has enough headroom. Signed-off-by: Cedric Izoard --- net/mac80211/rx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index d2a00f2..1ed32b4 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -2468,7 +2468,11 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) if (!ifmsh->mshcfg.dot11MeshForwarding) goto out; - fwd_skb = skb_copy(skb, GFP_ATOMIC); + if (skb_headroom(skb) >= local->tx_headroom) + fwd_skb = skb_copy(skb, GFP_ATOMIC); + else + fwd_skb = skb_copy_expand(skb, local->tx_headroom, + 0, GFP_ATOMIC); if (!fwd_skb) { net_info_ratelimited("%s: failed to clone mesh frame\n", sdata->name);