Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp6138263yba; Tue, 14 May 2019 02:19:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqyXFR9P5iEvNccDWNcGN7HmyvhnKIB38Huk21KQ4F2jV6tIKvmAhmaBYeClVhpDOhIekGLd X-Received: by 2002:a63:6988:: with SMTP id e130mr37315727pgc.150.1557825565779; Tue, 14 May 2019 02:19:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557825565; cv=none; d=google.com; s=arc-20160816; b=UdcQ6ezgZhy3YJiQwZJmqjwu+EswH45fK6dFr3GcRgnVLeeUs8d1y41fFFv3ggHNKg QK9ZXsQxXe2wOQAXQfDpd1NDvt/J+oT8XAwu0XKDAKd54psOHaM/ESjoXGuJY2kcRQKO +gnv6ubi0bIlksERgkze9QNR5n6urZ4Ss90zfD8TF5EqzbKmRSiDzD+pvovjz73QZUNh h1bpQpWt03lDNIfKup+jxJczrefQ39CNMeL56j4dyd1JJn8DhtSKR0jtw+vQi3BFalTo drEAeXAP1wtB58IW5XFkrc/7UIkjlStvfzVQgCJzJ3g9E48H3vHcNs8THSjMzbed7MOm VJWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=sLbarLb8qRE4yxuLQk9oDgzm+ri05RZ8RdQA2Dg+kyY=; b=VB9ZPR0z4Tbcysl9oZx8FO+gFgjS1dPeuBgUftPS9ZJ7+kooXUcoZqI2nxF5Thw1gh ZU/4qna2d1vZZ54OsUlLwwX5LVqdV5UZ8Zv0h1i54dOp2KGnv5IUdB3WOeC6LuiR/juN SHyUx2Iyq5gvtENUEmjgdcvohv5371LI7u4+Nc9vjNsS3pwAWld2OmUWQ09BbpneswaW 4lbuynS1kvKdoah8UgZF4JvdmgluzU0U7/QwwRHhEStB/+RnCR/SX8dGYZ3dS5hxJCTX thOBFCcWnCgKxaFmHyWvqfZ6cW5ytvykAB8G0zxFIUxamDq6gGQ1uLr5KU8z8PMi9LJU h01Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="JjYyG/R7"; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y14si19370397pga.217.2019.05.14.02.19.10; Tue, 14 May 2019 02:19:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="JjYyG/R7"; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726122AbfENJTG (ORCPT + 99 others); Tue, 14 May 2019 05:19:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:42238 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725916AbfENJTF (ORCPT ); Tue, 14 May 2019 05:19:05 -0400 Received: from lore-desk-wlan.redhat.com (unknown [151.66.17.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 37BA820843; Tue, 14 May 2019 09:19:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557825544; bh=UWu65s8fklFxGAd8cAu4ZkXRcD6Fd/ugPltRfGOZ+bY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JjYyG/R7foGq3mN18syfiXbIg4KmVYXzwelkWOLW0nl44va5iid58V+R1RzooMhBV FlDfJfFwRpvpUkK6sFcHKONisYQWShIOgIo0FxhwpFLHG/1HHeOHlwLE6jYupBGATe 6HTG9icAhgWfpRzyxOH1BaKaxmjhZUsgOkOsP7QQ= From: Lorenzo Bianconi To: nbd@nbd.name Cc: lorenzo.bianconi@redhat.com, linux-wireless@vger.kernel.org, ryder.lee@mediatek.com, royluo@google.com Subject: [PATCH] mt76: mt7615: do not process rx packets if the device is not initialized Date: Tue, 14 May 2019 11:18:52 +0200 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Fix following crash that occurs when the driver is processing rx packets while the device is not initialized yet $ rmmod mt7615e [ 67.210261] mt7615e 0000:01:00.0: Message -239 (seq 2) timeout $ modprobe mt7615e [ 72.406937] bus=0x1, slot = 0x0, irq=0x16 [ 72.436590] CPU 0 Unable to handle kernel paging request at virtual address 00000004, epc == 8eec4240, ra == 8eec41e0 [ 72.450291] mt7615e 0000:01:00.0: Firmware is not ready for download [ 72.457724] Oops[#1]: [ 72.470494] mt7615e: probe of 0000:01:00.0 failed with error -5 [ 72.474829] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.14.114 #0 [ 72.498702] task: 805769e0 task.stack: 80564000 [ 72.507709] $ 0 : 00000000 00000001 00000000 00000001 [ 72.518106] $ 4 : 8f704dbc 00000000 00000000 8f7046c0 [ 72.528500] $ 8 : 00000024 8045e98c 81210008 11000000 [ 72.538895] $12 : 8fc09f60 00000008 00000019 00000033 [ 72.549289] $16 : 8f704d80 e00000ff 8f0c7800 3c182406 [ 72.559684] $20 : 00000006 8ee615a0 4e000108 00000000 [ 72.570078] $24 : 0000004c 8000cf94 [ 72.580474] $28 : 80564000 8fc09e38 00000001 8eec41e0 [ 72.590869] Hi : 00000001 [ 72.596582] Lo : 00000000 [ 72.602319] epc : 8eec4240 mt7615_mac_fill_rx+0xac/0x494 [mt7615e] [ 72.614953] ra : 8eec41e0 mt7615_mac_fill_rx+0x4c/0x494 [mt7615e] [ 72.627580] Status: 11008403 KERNEL EXL IE [ 72.635899] Cause : 40800008 (ExcCode 02) [ 72.643860] BadVA : 00000004 [ 72.649573] PrId : 0001992f (MIPS 1004Kc) [ 72.657704] Modules linked in: mt7615e pppoe ppp_async pppox ppp_generic nf_conntrack_ipv6 mt76x2e mt76x2_common mt76x02_lib mt7603e mt76 mac80211 iptable_nat ipt_REJECT ipt_MASQUERADE cfg80211 xt_time xt_tcpudp xt_state xt_nat xt_mu] [ 72.792717] Process swapper/0 (pid: 0, threadinfo=80564000, task=805769e0, tls=00000000) [ 72.808799] Stack : 8f0c7800 00000800 8f0c7800 8032b874 00000000 40000000 8f704d80 8ee615a0 [ 72.825428] 8dc88010 00000001 8ee615e0 8eec09b0 8dc88010 8032b914 8f3aee80 80567d20 [ 72.842055] 00000000 8ee615e0 40000000 8f0c7800 00000108 8eec9944 00000000 00000000 [ 72.858682] 80508f10 80510000 00000001 80567d20 8ee615a0 00000000 00000000 8ee61c00 [ 72.875308] 8ee61c40 00000040 80610000 80580000 00000000 8ee615dc 8ee61a68 00000001 [ 72.891936] ... [ 72.896793] Call Trace: [ 72.901649] [<8eec4240>] mt7615_mac_fill_rx+0xac/0x494 [mt7615e] [ 72.913602] [<8eec09b0>] mt7615_queue_rx_skb+0xe4/0x12c [mt7615e] [ 72.925734] [<8eec9944>] mt76_dma_cleanup+0x390/0x42c [mt76] [ 72.936988] Code: ae020018 8ea20004 24030001 <94420004> a602002a 8ea20004 90420000 14430003 a2020034 [ 72.956390] [ 72.959676] ---[ end trace f176967739edb19f ]--- Fixes: 04b8e65922f6 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets") Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c index 1d6ebea17132..1547bce561d3 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c @@ -73,6 +73,9 @@ int mt7615_mac_fill_rx(struct mt7615_dev *dev, struct sk_buff *skb) bool unicast, remove_pad, insert_ccmp_hdr = false; int i, idx; + if (!test_bit(MT76_STATE_RUNNING, &dev->mt76.state)) + return -EINVAL; + memset(status, 0, sizeof(*status)); unicast = (rxd1 & MT_RXD1_NORMAL_ADDR_TYPE) == MT_RXD1_NORMAL_U2M; -- 2.20.1