From 790dc4d825c910c8a2eda49fe9e6dd827519f0f4 Mon Sep 17 00:00:00 2001 From: Colin Percival Date: Sun, 5 Mar 2023 12:10:57 -0800 Subject: [PATCH] linux_80211: Don't dequeue lsta if not queued This fixes an instapanic when restarting wpa_supplicant on my laptop's iwlwifi device. After this change, iwlwifi enters a nonfunctional state if wpa_supplicant is restarted, but "service netif restart wlan0" is enough to get it working again. releng/13.2 candidate. Reviewed by: bz MFC after: 3 days (cherry picked from commit 3689f8aeab82150da6789be87b6c2f9385810c23) --- sys/compat/linuxkpi/common/src/linux_80211.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index d0a3b4b8586..06b52ebaec8 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -174,10 +174,13 @@ lkpi_lsta_remove(struct lkpi_sta *lsta, struct lkpi_vif *lvif) { struct ieee80211_node *ni; + IMPROVE("XXX-BZ remove tqe_prev check once ni-sta-state-sync is fixed"); + ni = lsta->ni; LKPI_80211_LVIF_LOCK(lvif); - TAILQ_REMOVE(&lvif->lsta_head, lsta, lsta_entry); + if (lsta->lsta_entry.tqe_prev != NULL) + TAILQ_REMOVE(&lvif->lsta_head, lsta, lsta_entry); LKPI_80211_LVIF_UNLOCK(lvif); lsta->ni = NULL; -- 2.45.0