Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9536723pxu; Mon, 28 Dec 2020 20:25:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJyBZKF5yPtmoTmVru3OzJKHq0s12WPpQEzkd6ANmLm2z4tkwZDBtMieOehloJF3U17Xg6rT X-Received: by 2002:a05:6402:129a:: with SMTP id w26mr45696342edv.355.1609215905503; Mon, 28 Dec 2020 20:25:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609215905; cv=none; d=google.com; s=arc-20160816; b=UnXWmllueaKz/XMS9YMTAabLUBEBhk06nfQ+Goge67LruXiR+OSVnpnpXEBsX6mKEB OAB2CU/iN2fUQtD0QQmg0/7BnKKKY7jffAXmvpuH9ik6fJc8kmkuTFcrQX928wD/IjHa KBLcuOOyCtSMvSJyHX8IeqLfRazO82aQLlbdZErjrX9QxfvFJ4e0jNftEaU/jFnR0kG+ hbdRUIzYqosGYD4BsQSOBr1+hZMaoLTL3BFp1i/Xh/74isunDAaFAnznPE0crH6YLfTK DiLXU02cf7tQfVwd0Gr5FFAagDCvRsP7S3wc4EgsXrp/2eALsQ2j4TZQ3dcGCK1j2Qc6 X5Qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=oSuSDSHXA0BjEvvI/crGoTZ/vmzdAxLxeeHPLD0Ed1I=; b=RRbFGLCZEGh3nLo8kqpfrK5QAHBvToiDL6TDnSCsz8lADoeXDBDYrmnmeOL1+FLBoJ NfKHQofb4N9cBNFpi724cCVzFg5fEr5gL/1S+2yTjJHsOfEuMLTeclAb80CNtMkOxrI5 hRZyaqCxT/1XHHs9UU49if3f+RAF3G+xzvUsgKReW2aY0vbXZQQj7BlKZ1u2JdJxKqUg RCkMAuU+U46DvRO6xHdPAOoQyP8Fga7IEzf5HPRsnqDq+e//TfYBoViVaa938KcBRpif T9krNzIL/YAxZtw/cUphyok+CJRVPIdXLaOhZtFJRwbHbLjQ/RUQuztQ+P3Roy9T1FUu MIvQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c5si19467676ejz.259.2020.12.28.20.24.34; Mon, 28 Dec 2020 20:25:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726960AbgL2EV2 (ORCPT + 99 others); Mon, 28 Dec 2020 23:21:28 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:41410 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726014AbgL2EV1 (ORCPT ); Mon, 28 Dec 2020 23:21:27 -0500 X-UUID: b11b50ffa73247058cc372dfa7aaf2a5-20201229 X-UUID: b11b50ffa73247058cc372dfa7aaf2a5-20201229 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1311909604; Tue, 29 Dec 2020 12:15:34 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs08n2.mediatek.inc (172.21.101.56) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 29 Dec 2020 12:15:30 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 29 Dec 2020 12:16:36 +0800 From: Ryder Lee To: Felix Fietkau , Lorenzo Bianconi CC: Shayne Chen , , , Ryder Lee Subject: [PATCH] mt76: mt7915: drop zero-length packet to avoid Tx hang Date: Tue, 29 Dec 2020 12:15:30 +0800 Message-ID: X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: 73D45B84F648B856B2FED6EF0181AE82A83F489DEC913880F16216F9A59B7CA12000:8 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Hardware wouldn't add LLC-SNAP when skb->data_len is 0, which causes Tx hang, so add a check to drop this kind of packet. Tested-by: Bo Jiao Signed-off-by: Ryder Lee --- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c index f504eeb221f9..a2d63b7a346a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c @@ -942,6 +942,9 @@ int mt7915_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr, int id, i, nbuf = tx_info->nbuf - 1; u8 *txwi = (u8 *)txwi_ptr; + if (unlikely(tx_info->skb->len <= ETH_HLEN)) + return -EINVAL; + if (!wcid) wcid = &dev->mt76.global_wcid; -- 2.18.0