From patchwork Tue Dec 29 04:15:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryder Lee X-Patchwork-Id: 11991929 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CF15C433DB for ; Tue, 29 Dec 2020 04:16:11 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1905B208BA for ; Tue, 29 Dec 2020 04:16:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1905B208BA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=z7yzPoHnxKzUD2sTnhj4btA6Is1UAKS04Di5TMb/pV8=; b=Y9mkebBPZChBy1y/X2QsRt6uYX lroXFwPx5/dskkDFPc3Fgl9lQgLSqTlBC9e/Gnmx+GYMgx61nKAr/f4QhvGPUxBg8STvHHdtGMmFT Zc6D3/X9MR6M+XQw196Ecd9JJ+frJMif/PvjUp47gGII4A4RdkIzX82wLvBCtzF3+tZNlNcZLTUnv XgB1wPSCXFvUH7JeAFhOe9n7pfDGUnV8QaSuDWlpUJZX7Rb7et+vk9uyk8uiKZczML4mglKnGKYEK xVXPXW/ygXedI4ih+ovgi8Lkl7Tafnxe+zROmd7jsSk3QidaAQsGJlGEy8U6XM2RAVxn8i2L9yJnA VMFAHAMQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ku6QO-0000Wg-76; Tue, 29 Dec 2020 04:15:56 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ku6QH-0000SP-OA for linux-mediatek@lists.infradead.org; Tue, 29 Dec 2020 04:15:51 +0000 X-UUID: faba32d679b64f4aadab6a75ac38a636-20201228 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=ifrn9k91vm8YK6BpHSS4heM482XCldWk7ZE630AttW8=; b=XZEnfF2ews3P/+pwfWVbORpxtxY8UnEQ5SjgyYlaHYphMp6Ebx3mfAKpMJAievuabcuExK+doVrt+JYsQXtkyc27/6LbRBjmUasFLCY9k0IEPPWS53LFGK3G3R1pG4YnVqq92zd7VxtNCZhYb4/bN7jf5N/Sy7tb0yRBwIvHwzo=; X-UUID: faba32d679b64f4aadab6a75ac38a636-20201228 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 263108705; Mon, 28 Dec 2020 20:15:42 -0800 Received: from mtkmbs08n2.mediatek.inc (172.21.101.56) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 28 Dec 2020 20:16:45 -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 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 X-TM-SNTS-SMTP: 73D45B84F648B856B2FED6EF0181AE82A83F489DEC913880F16216F9A59B7CA12000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201228_231550_645912_9AD02869 X-CRM114-Status: UNSURE ( 8.28 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-mediatek@lists.infradead.org, Ryder Lee , linux-wireless@vger.kernel.org, Shayne Chen Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.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;