From patchwork Wed Sep 8 07:29:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Ma X-Patchwork-Id: 1525662 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=TLlg/1Q8; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4H4DKh6D2Hz9tD5; Wed, 8 Sep 2021 17:29:27 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1mNs1M-00031u-21; Wed, 08 Sep 2021 07:29:24 +0000 Received: from smtp-relay-canonical-0.internal ([10.131.114.83] helo=smtp-relay-canonical-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1mNs1H-000310-J6 for kernel-team@lists.ubuntu.com; Wed, 08 Sep 2021 07:29:19 +0000 Received: from localhost.localdomain (unknown [222.129.32.23]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id 7F9A43F04C for ; Wed, 8 Sep 2021 07:29:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1631086159; bh=cDW8qdlYjZ/8GuwdYMKgyCQqZ8rGVG0HOVM/inm5PEk=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=TLlg/1Q8zPopKnnXzgPYLNV4Z0lpu9o+JRo0cK/jfkQgD1wChYvp3Jj9QNOUWvx7H VNxlqVA6ufTq1KehzA8ESrJK3oFsO1NtwVFJeBxXhwOwgP/hNWP2SF5600uStFdnm8 k6PK4UKqbaGv4ZW5dJQj+SCZ6GiTG+8rGMB2A56eTSxM0f8y59C5tVPNCZBIWbdjAe i3rV3hv+GWPMkA+WJwiwOalIWcPmATTdnfz3PKEuH64+yB2Ywbzg9D7FUWZ0Xb1zZj XvEFiyWTX2i8RaMstBjQ2ocD/07LX1r49Tlk6SgXkMRSyViZvtIJ8bjZT6f3ND333V xJXv3AIuQ6TYA== From: Aaron Ma To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/1][OEM-5.13/OEM-5.14/U] UBUNTU: SAUCE: mt76: mt7921: Fix out of order process by invalid event pkt Date: Wed, 8 Sep 2021 15:29:07 +0800 Message-Id: <20210908072907.41312-2-aaron.ma@canonical.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210908072907.41312-1-aaron.ma@canonical.com> References: <20210908072907.41312-1-aaron.ma@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Deren Wu BugLink: https://bugs.launchpad.net/bugs/1942994 The acceptable event report should inlcude original CMD-ID. Otherwise, drop unexpected result from fw. Fixes: 1c099ab44727c ("mt76: mt7921: add MCU support") Signed-off-by: Jimmy Hu Signed-off-by: Deren Wu Signed-off-by: Felix Fietkau (cherry picked from commit e53e84d2c34027d78528e37fd611de85526a2c39 https://github.com/nbd168/wireless.git branch mt76) Signed-off-by: Aaron Ma --- drivers/net/wireless/mediatek/mt76/mt7921/mcu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c index f7459ad2a073..bc8e3327a49f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c @@ -157,6 +157,7 @@ mt7921_mcu_parse_response(struct mt76_dev *mdev, int cmd, struct sk_buff *skb, int seq) { struct mt7921_mcu_rxd *rxd; + int mcu_cmd = cmd & MCU_CMD_MASK; int ret = 0; if (!skb) { @@ -194,6 +195,9 @@ mt7921_mcu_parse_response(struct mt76_dev *mdev, int cmd, skb_pull(skb, sizeof(*rxd)); event = (struct mt7921_mcu_uni_event *)skb->data; ret = le32_to_cpu(event->status); + /* skip invalid event */ + if (mcu_cmd != event->cid) + ret = -EAGAIN; break; } case MCU_CMD_REG_READ: {