From patchwork Mon Jul 2 20:32:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 10502359 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 5E30860545 for ; Mon, 2 Jul 2018 20:32:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4EEBA28C5D for ; Mon, 2 Jul 2018 20:32:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 431F928D4E; Mon, 2 Jul 2018 20:32:30 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 DAEB428D12 for ; Mon, 2 Jul 2018 20:32:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752808AbeGBUc2 (ORCPT ); Mon, 2 Jul 2018 16:32:28 -0400 Received: from mail-it0-f65.google.com ([209.85.214.65]:36264 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752208AbeGBUcS (ORCPT ); Mon, 2 Jul 2018 16:32:18 -0400 Received: by mail-it0-f65.google.com with SMTP id h19-v6so123335itf.1 for ; Mon, 02 Jul 2018 13:32:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mojatatu-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vqDi/WTzreuRfVy5LMGoCvq5fEVvTRmMSN+N5Ws23mY=; b=v3wsxPRoEyy7DGCdQ83DhKJ12AUJddcWO3/l3K7CJcXN+hJfAObfMOy7r/V4xMSwWo aUxOAwUDLcuMwh2hPhXB0WSpfJqgOhZxx8BqjwJD9HQ0uz06q4Qg/jn66oiz4/y24Lut zyP0hGnIA2SjIucJ39p5qBQ8Y/RauBP8EB+a3PvspmSzzU8RvQoRg7Wgnu9N0WP+87yp KIFjC3na2Okt6oyaF0kwiKVZ2Z9Prwxjw61UKlaMkXP8/EzGSd0ocaVEO8gbKzRMliXZ NEo4XJaGG2NOeAOqI8Sonl0L3/MAQAPWavetpwnr+7DhWmTD7tFZA+kWIrhiz4LWYMLN 9VYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vqDi/WTzreuRfVy5LMGoCvq5fEVvTRmMSN+N5Ws23mY=; b=B/LQIia1SFfL74WTAx1lHbbMwujOTpB5JxUYReBcLeJ/IOl0h0X7xgohJ+fhZuuKOF 0TUlFGJqYHvFa1w6eZeHyv/Cyx4CrnLxmuMLEp77DQVb+bjZ3dG9u74yb2UFqFpCxSGO dwk0Y6o+VOzRuN+Tr6PsedCUX7rlt6JN0CNJAiHn+BZWb+AJPNUBDgNvBwMvoNVxCf1e RAOG1iW2WzFaUxBi1K+f6whonwJVHOpU158E/h4lgIJILplkEwfA07XLODiONrYKoj8x G5Gm+wDfuELKrDS1LTIkE1a1tEnGwYtSrghhgehKAPGD3wJaeNeIko+/sTB7qSY0TcBx WFmQ== X-Gm-Message-State: APt69E0upRcclqsaihSNBcC7dOQsAIhyfdwpc2f1SKPf1r1PVcsnypRT 3XHwOKWOiGHdgJC7qP6T4p76Zw== X-Google-Smtp-Source: AAOMgpeCE6HrYMrjIA+nRsDxGx5WmEmWKX6JrCQdPxTQKZ4Jx1ITod+2QrWr7RtUy5byKaK9MxTjvQ== X-Received: by 2002:a24:1a17:: with SMTP id 23-v6mr7229857iti.149.1530563537146; Mon, 02 Jul 2018 13:32:17 -0700 (PDT) Received: from x220t.lan ([64.26.149.125]) by smtp.gmail.com with ESMTPSA id h75-v6sm725562ioh.50.2018.07.02.13.32.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Jul 2018 13:32:16 -0700 (PDT) From: Alexander Aring To: stefan@osg.samsung.com Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org, kernel@mojatatu.com, Alexander Aring Subject: [PATCH wpan 2/2] net: mac802154: tx: expand tailroom if necessary Date: Mon, 2 Jul 2018 16:32:03 -0400 Message-Id: <20180702203203.21316-2-aring@mojatatu.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180702203203.21316-1-aring@mojatatu.com> References: <20180702203203.21316-1-aring@mojatatu.com> Sender: linux-wpan-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch is necessary if case of AF_PACKET or other socket interface which I am aware of it and didn't allocated the necessary room. Reported-by: David Palma Reported-by: Rabi Narayan Sahoo Signed-off-by: Alexander Aring --- net/mac802154/tx.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c index 7e253455f9dd..bcd1a5e6ebf4 100644 --- a/net/mac802154/tx.c +++ b/net/mac802154/tx.c @@ -63,8 +63,21 @@ ieee802154_tx(struct ieee802154_local *local, struct sk_buff *skb) int ret; if (!(local->hw.flags & IEEE802154_HW_TX_OMIT_CKSUM)) { - u16 crc = crc_ccitt(0, skb->data, skb->len); + struct sk_buff *nskb; + u16 crc; + + if (unlikely(skb_tailroom(skb) < IEEE802154_FCS_LEN)) { + nskb = skb_copy_expand(skb, 0, IEEE802154_FCS_LEN, + GFP_ATOMIC); + if (likely(nskb)) { + consume_skb(skb); + skb = nskb; + } else { + goto err_tx; + } + } + crc = crc_ccitt(0, skb->data, skb->len); put_unaligned_le16(crc, skb_put(skb, 2)); }