Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1435270lqt; Wed, 20 Mar 2024 04:10:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV3HD3rNNot7Pz5/Lqi2oTE4c1KHWYkK1j0NIXTArmnZag0CdsHtXtsdjdq53SH0qX6ZkiOwazHM6V0JgH7/MpsABwAj4Hm8dmfs4wf5A== X-Google-Smtp-Source: AGHT+IETRktwMh1b8bDiOd7RAN7bXeKnixOTySR+DVl1P6I4jmUwlX5rO5pOJXhUFO7Zreoyk37c X-Received: by 2002:a05:6358:311d:b0:17e:b72a:b4c6 with SMTP id c29-20020a056358311d00b0017eb72ab4c6mr18083018rwe.27.1710933012872; Wed, 20 Mar 2024 04:10:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710933012; cv=pass; d=google.com; s=arc-20160816; b=Dw8qMAEVNeSoFgTACa2i3sbHw2Ff5H177+0OzdUVfhHQJXXC8JEtJQih57/cMSb7dz grWuxZ4WvomES/g1lHbVbubQLe4n3mG+UI15R9SpEndPLMdwVj29DMdFXzi2qAO4tsQf X5qjIt0Vk6dIs1GAep/ALU7v3cM/HyroYgx2aFOOxGr8xhIJzRsUrbR8rWaJnkr/JNNy l2Khw4Fm6f3eBI4Alcdw2miDQsaZQ8sR8CxY7UoOHwPI/ka+VSVPJgjCg7agfOHgr6WU gueKKc9AafN99yP4fJB0Cq0ZcCInx45gemF8L16Ej9KK+u/ErvoAjzLczpP027BMK9t8 XtPg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=K+MGvbJYjhy895if8D0sU6axrp3f+KhPZVFX8vDFO74=; fh=v/c0XK0bpjErmc8D1qiPKKmJzDQvxG1Pmm839PeT1FY=; b=R6Dz7mYdfSKZtx2+VClKurN51gxFrFnTqeAXVrAwH0jl6VbjpSJf0aUVUXurSlDiIj fxT/B+jHVm4ghdfBKhl5PlHE/x3fSHJV5+E5uT5I6g/X4xUiltXF/rMiRnA8WXvnFZ5+ lVfwfObcvlqdoX+f796Eib7rrRJyNhH9GARz3iL7nBShOmT2zX2MJ4oAONOD2didvSrj Tfje7H5EmgzYbOi4BLCTRv6Eu1PzDPigeI2JDCQGX7etS42/ZDlZLtS4UeS081VJdTy8 /J1cQ6g194gSx7KRylS+Dz4qRF9Kdo3nxt0iOYy+LaDqggN/c6ygTf6+pJH1MwlHAT9h Squw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=Fl8G3QP7; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-wireless+bounces-4977-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4977-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id h36-20020a635764000000b005dc42a836a3si12261795pgm.625.2024.03.20.04.10.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 04:10:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-4977-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=Fl8G3QP7; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-wireless+bounces-4977-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4977-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5A2E3283B19 for ; Wed, 20 Mar 2024 11:10:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7F4813FBBE; Wed, 20 Mar 2024 11:09:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="Fl8G3QP7" X-Original-To: linux-wireless@vger.kernel.org Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9907F3FBB2 for ; Wed, 20 Mar 2024 11:09:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.61.82.184 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710932979; cv=none; b=MXhp8VIuSEespuNsIuTtlk4CsuIWipezCL6Aue3F5VD/hJeByKpdTk4eqzTzeZmJHfdxGHwRoukMOcDUid4l/SWDdQdI/74BSrFjPvAw55jwyRSWE7R8z0KOGqD5snTK/c0y2LsQoXDpUeIDtITxRAAthJN2W/qTbOigciE6a/0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710932979; c=relaxed/simple; bh=+j53oCYm9KhKA++JU2qI6mmi/RT3kjI/VHswK5c6OPo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mgcdWYSuk1RcC7nPUrxKqXyNmTHy8vsMWKRzHWKGlZelbsit9D84vzLFYPZavCLpNBAReuAGCfmI0ww0HZBGaUsZqKaUNHIJI0Cstfy58urd0w7wb4wMuqCroUiIBuzNZZuzcNsTxQLIGjvh6zXUFZXOMjsDrOEpa7Oxrtzpav4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com; spf=pass smtp.mailfrom=mediatek.com; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b=Fl8G3QP7; arc=none smtp.client-ip=210.61.82.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mediatek.com X-UUID: 5064aa56e6aa11ee935d6952f98a51a9-20240320 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=K+MGvbJYjhy895if8D0sU6axrp3f+KhPZVFX8vDFO74=; b=Fl8G3QP7SKNDfmM+koblgjFicKJ7WTtg+7qcPXzyN8kID7RDOychurrr0Cdcz5HygyQJteBvhnff9luIWTv3YrFfnm3Weo2CmnZl92UwxCie1rRUkQZcw0Y1o8fxsXsRzQcfE8Pohx0+CkOR+zlCO9s7OzoufhCEFAlo7kZLm48=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.37,REQID:c5190fa3-047e-412e-8ffb-ebd43f67468f,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:6f543d0,CLOUDID:f3d9b881-4f93-4875-95e7-8c66ea833d57,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1, SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 5064aa56e6aa11ee935d6952f98a51a9-20240320 Received: from mtkmbs11n2.mediatek.inc [(172.21.101.187)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 520570354; Wed, 20 Mar 2024 19:09:26 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by MTKMBS14N1.mediatek.inc (172.21.101.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Wed, 20 Mar 2024 19:09:24 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Wed, 20 Mar 2024 19:09:24 +0800 From: Shayne Chen To: Felix Fietkau CC: linux-wireless , Lorenzo Bianconi , Ryder Lee , Evelyn Tsai , Bo Jiao , linux-mediatek , Henry Yen , Shayne Chen Subject: [PATCH 10/10] wifi: mt76: mt7996: add sanity check for NAPI schedule Date: Wed, 20 Mar 2024 19:09:18 +0800 Message-ID: <20240320110918.3488-10-shayne.chen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20240320110918.3488-1-shayne.chen@mediatek.com> References: <20240320110918.3488-1-shayne.chen@mediatek.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-AS-Result: No-10--1.702000-8.000000 X-TMASE-MatchedRID: t43B5J96WnnRf7QIWE0s11Pjo7D4SFg4gQP483M95wG7+NPPxj+R6t/Z UmGP9YkbhowmdCKCKbJQvZkUW2KxIxTHZeyG5hlHKaMQ6tw7oDJMkOX0UoduuQqiCYa6w8tvwnA mnjhKdO06hUOcTonr9IAy6p60ZV62fJ5/bZ6npdjKayT/BQTiGvSCB5CtNVQm9h6EyZUhUzJM/6 T6cXS4kA7HGxMqtNz79LqXQCbqlpj98p0nQevxSqjbnW3VwgJ6XTIolEqa8UudEJeX4QSuE6DE4 wLr4uZ8dATQdtPksR+3/JiWOe6GXXSWgQ2GpXdZbxffl9hhCBw= X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--1.702000-8.000000 X-TMASE-Version: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-SNTS-SMTP: 023958FE130D5E334E7896CE6F46781782A9312B444C4D588DFEA1FE25D904B22000:8 X-MTK: N From: Henry Yen It's observed that host driver might occasionally receive interrupts from unexpected Rx ring, whose Rx NAPI hasn't been prepared yet. Under such situation, __napi_poll crash issue would occur, so we add a sanity check to prevent it. Without this patch, we might encounter kernel crash issue especially in WED-on & RRO-on software path. Signed-off-by: Henry Yen Signed-off-by: Shayne Chen --- drivers/net/wireless/mediatek/mt76/mt7996/mmio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mmio.c b/drivers/net/wireless/mediatek/mt76/mt7996/mmio.c index 304e5fd14803..6de5b7de4ac8 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/mmio.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mmio.c @@ -560,7 +560,7 @@ static void mt7996_irq_tasklet(struct tasklet_struct *t) napi_schedule(&dev->mt76.tx_napi); for (i = 0; i < __MT_RXQ_MAX; i++) { - if ((intr & MT_INT_RX(i))) + if ((intr & MT_INT_RX(i)) && dev->mt76.napi[i].poll) napi_schedule(&dev->mt76.napi[i]); } -- 2.39.2