p2p: early return if p2p interface is not available yet.
addGroup_1_2 would access global p2p instance in several places
internally. If p2p interface is not available, just return failure
at the beginning.
Fixes: 141773120
Bug: 141773120
Test: atest VtsHalWifiSupplicantP2pV1_2TargetTest
Change-Id: I424d5fd35c6f2dd84833141262988a052bf00871
diff --git a/wpa_supplicant/hidl/1.2/p2p_iface.cpp b/wpa_supplicant/hidl/1.2/p2p_iface.cpp
index 4df65aa..0a6b657 100644
--- a/wpa_supplicant/hidl/1.2/p2p_iface.cpp
+++ b/wpa_supplicant/hidl/1.2/p2p_iface.cpp
@@ -1634,6 +1634,10 @@
int vht = wpa_s->conf->p2p_go_vht;
int ht40 = wpa_s->conf->p2p_go_ht40 || vht;
+ if (wpa_s->global->p2p == NULL) {
+ return {SupplicantStatusCode::FAILURE_IFACE_DISABLED, ""};
+ }
+
if (!isSsidValid(ssid)) {
return {SupplicantStatusCode::FAILURE_ARGS_INVALID, "SSID is invalid."};
}
@@ -1643,10 +1647,6 @@
}
if (!joinExistingGroup) {
- if (wpa_s->global->p2p == NULL) {
- return {SupplicantStatusCode::FAILURE_IFACE_DISABLED, ""};
- }
-
struct p2p_data *p2p = wpa_s->global->p2p;
os_memcpy(p2p->ssid, ssid.data(), ssid.size());
p2p->ssid_len = ssid.size();