rtw88: enclose c2h cmd handle with mutex
authorYan-Hsuan Chuang <yhchuang@realtek.com>
Wed, 31 Jul 2019 12:22:46 +0000 (20:22 +0800)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 6 Aug 2019 12:42:12 +0000 (15:42 +0300)
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 <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/realtek/rtw88/fw.c

index 3c4dcb7cf69e5970a6ee60b9e5ade28d924f1f9a..3b06f7150c412a6c43157233ce71aa192df98b6e 100644 (file)
@@ -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,