Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp5934946ybi; Wed, 31 Jul 2019 05:44:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqyjXQhxrWKiw8GC1qJKGmo2L5bI7EgHILgJdzk8sibyAiaqoQFCvXEA5v5v2SWdjiQqKpaN X-Received: by 2002:a62:cd45:: with SMTP id o66mr48049168pfg.112.1564577075691; Wed, 31 Jul 2019 05:44:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564577075; cv=none; d=google.com; s=arc-20160816; b=ffMU2X6grXqsf7ZtkZIeH568OGoiVNLxH3VAAf4IB8kQdd5K4Tup2JzbRHOebyulCd Wgvnz9V1QPPn4IMPYvxf0ODlVq+F/vlv+icMVN9pGRWqlqJtiVkqyhKWatTQcpjC+95A 9nk27cLbUus7CtBl0Ak++p6Gp1QjAM0gzTTuM0ndA+TUYjjuMfmtszEV7fsuKG99v+k9 rKu20dorKyEmpcpEDi5uOKx9TQMG2piPB8Ss9FrGENifXNkqiGcc0RWpOlBWT7y2cDHC 6Ci4DPBFPqlR8MSNwNeA6Q/e8b8Ly5A9oUTd7W9Tw5O+qnseUV9IXbaQr9jslMPo6Gk8 8YcQ== 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=pj72DZslO5E0Ha3dq7hk8v3FUtk34E3fAga6hrHd9Jk=; b=gRcN96rwTS3W9RO1BC7e5NTrrKIjDEwSb3FlfU/3m2+LMt2Na/BXVViZND4qSbRb/P f+rzjjs/3EwAc+QFjomQVjC+nWoGgYSCxbs4/MEnmQps1JnK5tum+XMNZ3yO9gmUUQ/n 02IcVFXUHAqOzf0PV7xhxN5wONXdguLyWG+9sH4Lf9R1GZkWGO899/W1HPnFChSANE6h gQRMc6PPTo1qj+iow85ka0uiXGHS/MSuOVnGswmpdzI6DTQ8l9hr4CitpPCpnudzbmCo GERjFOppJU+gCR+2/OHXyJKeOcNuZrgKLIaARdsXKi48cfi8I0p6DILZ6ZEwRyWNWIwJ W5Uw== 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 e2si33896186pfn.32.2019.07.31.05.44.20; Wed, 31 Jul 2019 05:44:34 -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 S1727584AbfGaMXH (ORCPT + 99 others); Wed, 31 Jul 2019 08:23:07 -0400 Received: from rtits2.realtek.com ([211.75.126.72]:36783 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726561AbfGaMXH (ORCPT ); Wed, 31 Jul 2019 08:23:07 -0400 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.62 with qID x6VCMtjF007670, 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 x6VCMtjF007670 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 31 Jul 2019 20:22:55 +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, 31 Jul 2019 20:22:54 +0800 From: To: CC: , , Subject: [PATCH v3 2/3] rtw88: enclose c2h cmd handle with mutex Date: Wed, 31 Jul 2019 20:22:46 +0800 Message-ID: <1564575767-27557-3-git-send-email-yhchuang@realtek.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1564575767-27557-1-git-send-email-yhchuang@realtek.com> References: <1564575767-27557-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 --- v1 -> v2 no change v2 -> v3 no change 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