[PATCH 4.9 45/87] wcn36xx: Dont use the destroyed hal_mutex

From: Greg Kroah-Hartman
Date: Mon Nov 13 2017 - 08:22:12 EST


4.9-stable review patch. If anyone has any objections, please let me know.

------------------

From: Bjorn Andersson <bjorn.andersson@xxxxxxxxxx>


[ Upstream commit d53628882255481b710641dd0118fbd80af6e983 ]

ieee80211_unregister_hw() might invoke operations to stop the interface,
that uses the hal_mutex. So don't destroy it until after we're done
using it.

Signed-off-by: Bjorn Andersson <bjorn.andersson@xxxxxxxxxx>
Signed-off-by: Kalle Valo <kvalo@xxxxxxxxxxxxxxxx>
Signed-off-by: Sasha Levin <alexander.levin@xxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
drivers/net/wireless/ath/wcn36xx/main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -1165,11 +1165,12 @@ static int wcn36xx_remove(struct platfor
wcn36xx_dbg(WCN36XX_DBG_MAC, "platform remove\n");

release_firmware(wcn->nv);
- mutex_destroy(&wcn->hal_mutex);

ieee80211_unregister_hw(hw);
iounmap(wcn->dxe_base);
iounmap(wcn->ccu_base);
+
+ mutex_destroy(&wcn->hal_mutex);
ieee80211_free_hw(hw);

return 0;