mac80211: print an error if wifi teardown fails
authorBob Cantor <coxede6557@w3boats.com>
Thu, 24 Jun 2021 18:14:47 +0000 (04:14 +1000)
committerFelix Fietkau <nbd@nbd.name>
Mon, 28 Jun 2021 15:24:11 +0000 (17:24 +0200)
drv_mac80211_teardown fails silently if the device to be torn down is
not defined.  This commit prints an error message.

branches affected: trunk, 21.02

Signed-off-by: Bob Cantor <coxede6557@w3boats.com>
package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh

index ffb3662d04ff51d8cb781c960caf240bd841c6df..0b7a84d7c9588da456760e0208a1fb5072a2f42f 100644 (file)
@@ -1190,6 +1190,10 @@ drv_mac80211_teardown() {
        json_select data
        json_get_vars phy
        json_select ..
+       [ -n "$phy" ] || {
+               echo "Bug: PHY is undefined for device '$1'"
+               return 1
+       }
 
        mac80211_interface_cleanup "$phy"
        uci -q -P /var/state revert wireless._${phy}