Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9163828ybi; Tue, 23 Jul 2019 23:06:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqww/ScbsbrgOy5BkNtwIKD90/3uvL9gQbOi502XuOsoXcqgSBCTUwB4KMzrXK6ZLfW45SFU X-Received: by 2002:a62:ce07:: with SMTP id y7mr9232995pfg.12.1563948419633; Tue, 23 Jul 2019 23:06:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563948419; cv=none; d=google.com; s=arc-20160816; b=YyeFf8Q3VRjCy7ilQKcQ3gz0ShTuO2hgB/5KX9AvcK2WuDr85AXzRPoBwZvE6p8Aii BbpAd0f/TSEVYhPvi3kX3MicaO+Qe8L5bH4OyzDnLGnv5JjKiMHSB691IKTy7ojn5M8o dKjvXX8sAh4VTW5pDfjc0JnDtaJp9f47HQaU4wafGheFWM5Fmghu/wsStMAiwcf6h4+C WcoFsNfadkqncUnKE74pC8tthtucL/Bbjvts/YZVLlrezFx2oODOiH5vWDBaPSbNFsTI TJozdfHZepcq3KJfn5vH3T71Top936q32p3Bjf1nTW/xIAslV0Xfj/TRbRVe0zHPxOyt jHOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:authenticated-by; bh=+hKoPvinktAQLOQJYqOsvjBBTCyUFJ8yh5NDZcuIHSw=; b=0rTJ2KreVTAoKKYPKFgRlW0uAgIgK7XNK1sJ/GZicAw9mYBci3fafIPjXEKxmN105M u+6Cn5WS90jgyIhcYF0teLgDGwy56KTJJfQ7cq7UUdHnvOyyV5RRNzgqaTv5dgvlUTkZ zUugrnchBKnXGcXfd6cpIsGBSweoNouCzb3QdeblHSOnvO7ok7785t/Fx65TRMdGOTO2 A9Oc5J7s0PqpbR2XOR7syp+6v1iEGbJKBTYnG1DcQhOAznG2al6+GMLQc4b9GVMaTtrB J0r6yF5WuwSOwAoAS86gOVm61mMAVb11Q4qrXNGdo5QFHfb2VRW3tNA1YhSFTrC6jdjr y3cg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l13si14502997pgp.133.2019.07.23.23.06.43; Tue, 23 Jul 2019 23:06:59 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726360AbfGXGFD (ORCPT + 99 others); Wed, 24 Jul 2019 02:05:03 -0400 Received: from rtits2.realtek.com ([211.75.126.72]:49314 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726323AbfGXGFC (ORCPT ); Wed, 24 Jul 2019 02:05:02 -0400 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.62 with qID x6O64rBT011121, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (RTITCASV01.realtek.com.tw[172.21.6.18]) by rtits2.realtek.com.tw (8.15.2/2.57/5.78) with ESMTPS id x6O64rBT011121 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 24 Jul 2019 14:04:53 +0800 Received: from localhost.localdomain (172.21.68.126) by RTITCASV01.realtek.com.tw (172.21.6.18) with Microsoft SMTP Server id 14.3.439.0; Wed, 24 Jul 2019 14:04:53 +0800 From: To: CC: , , Subject: [PATCH 4/5] rtw88: enclose c2h cmd handle with mutex Date: Wed, 24 Jul 2019 14:04:32 +0800 Message-ID: <1563948273-17910-5-git-send-email-yhchuang@realtek.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1563948273-17910-1-git-send-email-yhchuang@realtek.com> References: <1563948273-17910-1-git-send-email-yhchuang@realtek.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.21.68.126] Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Yan-Hsuan Chuang C2H commands that cannot be handled in IRQ context should be protected by rtwdev->mutex. Because they might have a sequece of hardware operations that does not want to be interfered. Signed-off-by: Yan-Hsuan Chuang --- drivers/net/wireless/realtek/rtw88/fw.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw88/fw.c b/drivers/net/wireless/realtek/rtw88/fw.c index 3c4dcb7..3b06f71 100644 --- a/drivers/net/wireless/realtek/rtw88/fw.c +++ b/drivers/net/wireless/realtek/rtw88/fw.c @@ -36,6 +36,8 @@ void rtw_fw_c2h_cmd_handle(struct rtw_dev *rtwdev, struct sk_buff *skb) c2h = (struct rtw_c2h_cmd *)(skb->data + pkt_offset); len = skb->len - pkt_offset - 2; + mutex_lock(&rtwdev->mutex); + switch (c2h->id) { case C2H_HALMAC: rtw_fw_c2h_cmd_handle_ext(rtwdev, skb); @@ -43,6 +45,8 @@ void rtw_fw_c2h_cmd_handle(struct rtw_dev *rtwdev, struct sk_buff *skb) default: break; } + + mutex_unlock(&rtwdev->mutex); } void rtw_fw_c2h_cmd_rx_irqsafe(struct rtw_dev *rtwdev, u32 pkt_offset, -- 2.7.4