From 674b27abc31a9a06aaf661332c012eb7a33219ee Mon Sep 17 00:00:00 2001 From: Nate Jiang Date: Wed, 26 Aug 2020 16:38:19 -0700 Subject: [PATCH] WifiNanIface: Validate interface before cleanup. Calling invalidate() API twice would lead to fatal error. This commit is to check if interface isValid() before doing other operations in invalidate() API. Bug: 166412651 Test: atest VtsHalWifiNanV1_4TargetTest WifiNanIfaceTest Change-Id: Ia3fc48bb3d98660705bba9a32b7a5845ff7af79f --- wifi/1.4/default/wifi_nan_iface.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wifi/1.4/default/wifi_nan_iface.cpp b/wifi/1.4/default/wifi_nan_iface.cpp index 5764d35ec4..24ffb176e8 100644 --- a/wifi/1.4/default/wifi_nan_iface.cpp +++ b/wifi/1.4/default/wifi_nan_iface.cpp @@ -534,6 +534,9 @@ WifiNanIface::WifiNanIface( } void WifiNanIface::invalidate() { + if (!isValid()) { + return; + } // send commands to HAL to actually disable and destroy interfaces legacy_hal_.lock()->nanDisableRequest(ifname_, 0xFFFF); legacy_hal_.lock()->nanDataInterfaceDelete(ifname_, 0xFFFE, "aware_data0");