Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp737490pxm; Thu, 3 Mar 2022 03:43:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJyX5uyMjRkpJTkZ4823Q1d7eeIEVgmKhYtsnx3Rq0UeZJqjciiS3/2sjsZvwJT5S3cWWoWk X-Received: by 2002:a50:f0d0:0:b0:413:362a:1563 with SMTP id a16-20020a50f0d0000000b00413362a1563mr33909910edm.393.1646307804895; Thu, 03 Mar 2022 03:43:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646307804; cv=none; d=google.com; s=arc-20160816; b=eonO5Uyf61x2MImHIMtby/65DHuuHzOAmTHKUjDVBNXowYTvYoh8z9JJTF7MiwkB68 7TVK7MOr1Rc5S/Oa0EjddVd1vXcqw46nsB5YqFe8dA87KAAlS95alPmU+K/BjqTMyXJQ V3iE+K8SpZKklxFKO60qdmyIJJ6YWn2HqScvqCmPPx63y+I1kmeov8EJ8NWmtRoOHSh3 0mJQ7oZoZqUYOBLk/KDHN+lkJ0cZX/55BCb/DhlKIcUzVwl4/nzPHK9JA1cicQdcIsa3 K7Tk4xjU7uNbB01idktaFRR5zGftojUbJvFkNZfH0UxC/CfwptrndmGf4Ae58lfRZXvY 4k6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=wrP0YGLJjVnL1KPZin2dZKbbc+ubtZHbXefedwSBKm0=; b=0jWUrrlOwtFOsmoscynAjUPD4fFLLcoeOlSW3DkxtlYQg+jm+96BVi+mekro/cCgZe EnMbgk/7rvs3dNHXkBlXQE/DNgh6/6ZlqUjOTWRPm6CHACw4FL8AQLGsYdANhtZdJ68T noF0XlIi9Yt6TU+NwigJDshRxO2NYzfY/vJQVRDPaX/ikkQR7ck9Dk5cy/p5f76CRr1p 7nuWbzyIY+MEUMOdZG90stn8fntjhM+fQclYsdPBofQTKsCidVIl6mUKeYTYiBfQgIkP XKgeEyGW0aGWEetjVngVXyXOCxQdNNLfLX1/AwWc/uGRWQ6zaySH86JviI/N3HO1cyiG 9Ykw== 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:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mp10-20020a1709071b0a00b006d6e577c059si1213440ejc.451.2022.03.03.03.43.05; Thu, 03 Mar 2022 03:43:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230513AbiCCJNy (ORCPT + 72 others); Thu, 3 Mar 2022 04:13:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229930AbiCCJNw (ORCPT ); Thu, 3 Mar 2022 04:13:52 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6323AF1F9 for ; Thu, 3 Mar 2022 01:13:06 -0800 (PST) X-UUID: 1822a6e0036444c5a0c459f5b93ea0b3-20220303 X-UUID: 1822a6e0036444c5a0c459f5b93ea0b3-20220303 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 421609529; Thu, 03 Mar 2022 17:12:59 +0800 Received: from mtkexhb02.mediatek.inc (172.21.101.103) 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 17:12:58 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkexhb02.mediatek.inc (172.21.101.103) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 3 Mar 2022 17:12:58 +0800 Received: from mtksdccf07 (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 17:12:58 +0800 Message-ID: <60fd581a57945efc1c6a2a8d58a88301a79e51ec.camel@mediatek.com> Subject: Re: [PATCH] mt76: fix monitor mode crash with sdio driver From: Deren Wu To: Felix Fietkau , Lorenzo Bianconi CC: Sean Wang , Soul Huang , YN Chen , Leon Yen , "Eric-SY Chang" , KM Lin , Robin Chiu , CH Yeh , Posh Sun , Eric Liang , Stella Chang , Evelyn Tsai , "Ryder Lee" , Shayne Chen , linux-wireless , linux-mediatek Date: Thu, 3 Mar 2022 17:12:58 +0800 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-MTK: N X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham 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 Hi Felix, I need to submit v2 patch. Please drop this one. Thanks, Deren On Thu, 2022-03-03 at 11:28 +0800, Deren Wu wrote: > 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