Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp439489pxm; Wed, 2 Mar 2022 19:30:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJy1rUFFwJ+bJzE1Xg+0ZK64Tl05s5DjhiwdsKPJybJ1f2wz1/Z6K7TlpHGYcmWMPkMTFa2I X-Received: by 2002:a05:6a00:1354:b0:4c9:1e96:d15c with SMTP id k20-20020a056a00135400b004c91e96d15cmr36191633pfu.30.1646278205433; Wed, 02 Mar 2022 19:30:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646278205; cv=none; d=google.com; s=arc-20160816; b=vvzPKeYuTwS+vgwTX6eeImHNgksbqL/jKXmS0zkYLvfBLsNnIxCCm+voFQUyugf/Yc ORiaJf+SzhYqXU2M1GgALg8ulLXvOcHilwK2eq0jx/ZwzMh0ZFUu9RP+fJaqK0iKDF5j AFuGKpMDMiduZFPGdYCEtVpzJ8pGwy8Hgv1KPQlTGDd/HDiXVXpTayyFSK/f2Ft2SUsF Cyo2V8ywmYhB+QvsbS6G27xAl7HmLYmnphoAzc9qp5D1sIf4zdVb6RjssyUcofn6ErqV ul2UWdTiuFdCAUg649oxZ4TwPSgO2v1a/5bcXlK/U7MQhSduvGJY7w5r3rgmZyIMP2KP 42UQ== 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=ZLR8u0P73Jvhy2mzcN0v9p09aWX9g5TMSp+EIu3xc/I=; b=bDoSx6NJhs/Nho89mhMOjQ5Kk6zSo4qy2s1oBSxCwYLASf9UIptUYBV2PwvCZode/Z Bzc6ukL6yyxzHGGCbaprh7pXylyODeRmn0emlfPPf5KJ0VHU+npS6ujBUbUWdV5eHLta F5Ktmz4waThHo+/Tac0fCv+486BJ83P8Q7iYvnEWQAbHCdpc1QOP84vUX/SWMHZOfzAW GL0Jaf9aNCOE8XWGkExymI4NTdHJ0kIRWBFrOEfGo4Lx2/NLLPR6CzVIexlQRWgdM3aY 3ian1DLApbcfszj/h5PRkU/Phb/fxkrg70zC5YraDsCn6cKsVXt/gaWXJ2RYjIqgno2B MHFA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id mq17-20020a17090b381100b001bd5400d018si937994pjb.148.2022.03.02.19.30.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 19:30:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4373021E23; Wed, 2 Mar 2022 19:29:02 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229473AbiCCD3j (ORCPT + 72 others); Wed, 2 Mar 2022 22:29:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229446AbiCCD3i (ORCPT ); Wed, 2 Mar 2022 22:29:38 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CAB833B for ; Wed, 2 Mar 2022 19:28:53 -0800 (PST) X-UUID: 3ce70156f4284a01b6bed69a66598b55-20220303 X-UUID: 3ce70156f4284a01b6bed69a66598b55-20220303 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 613262838; Thu, 03 Mar 2022 11:28:45 +0800 Received: from mtkexhb01.mediatek.inc (172.21.101.102) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.792.3; Thu, 3 Mar 2022 11:28:43 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkexhb01.mediatek.inc (172.21.101.102) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 3 Mar 2022 11:28:43 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 3 Mar 2022 11:28:43 +0800 From: Deren Wu To: Johannes Berg CC: Felix Fietkau , Lorenzo Bianconi , Sean Wang , Soul Huang , YN Chen , Leon Yen , Eric-SY Chang , Deren Wu , KM Lin , Robin Chiu , CH Yeh , Posh Sun , Eric Liang , Stella Chang , Evelyn Tsai , "Ryder Lee" , Shayne Chen , linux-wireless , linux-mediatek , Deren Wu Subject: [PATCH] mt76: fix monitor mode crash with sdio driver Date: Thu, 3 Mar 2022 11:28:40 +0800 Message-ID: X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Deren Wu mt7921s driver may receive frames with fragment buffers. If there is a CTS packet received in monitor mode, the payload is 10 bytes only and need 6 bytes header padding after RXD buffer. However, only RXD in the first linear buffer, if we pull buffer size RXD-size+6 bytes with skb_pull(), that would trigger "BUG_ON(skb->len < skb->data_len)" in __skb_pull(). To avoid the nonlinear buffer issue, enlarge the RXD size from 128 to 136 to make sure all MCU operation in linear buffer. 136 = 128 + 8 128 : RXD size 8 : max header padding length [ 52.007562] kernel BUG at include/linux/skbuff.h:2313! [ 52.007578] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP [ 52.007987] pc : skb_pull+0x48/0x4c [ 52.008015] lr : mt7921_queue_rx_skb+0x494/0x890 [mt7921_common] [ 52.008361] Call trace: [ 52.008377] skb_pull+0x48/0x4c [ 52.008400] mt76s_net_worker+0x134/0x1b0 [mt76_sdio 35339a92c6eb7d4bbcc806a1d22f56365565135c] [ 52.008431] __mt76_worker_fn+0xe8/0x170 [mt76 ef716597d11a77150bc07e3fdd68eeb0f9b56917] [ 52.008449] kthread+0x148/0x3ac [ 52.008466] ret_from_fork+0x10/0x30 Co-developed-by: Sean Wang Signed-off-by: Sean Wang Signed-off-by: Deren Wu --- drivers/net/wireless/mediatek/mt76/mt76.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index 5e10fe156926..4f4ce3b3df54 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -19,7 +19,8 @@ #define MT_MCU_RING_SIZE 32 #define MT_RX_BUF_SIZE 2048 -#define MT_SKB_HEAD_LEN 128 +/* 136 = 128+8. 128: RXD, 8:max header padding*/ +#define MT_SKB_HEAD_LEN 136 #define MT_MAX_NON_AQL_PKT 16 #define MT_TXQ_FREE_THR 32 -- 2.18.0