Skip to content

Commit e5e8f73

Browse files
committed
* Add missing wpa_supplicant mutex lock
Signed-off-by: Lo,Chin-Ran <chin-ran.lo@nxp.com>
1 parent 26bc7a0 commit e5e8f73

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/platform/Linux/ConnectivityManagerImpl.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,7 @@ CHIP_ERROR ConnectivityManagerImpl::_WiFiPAFPublish(ConnectivityManager::WiFiPAF
878878
MAX_PAF_PUBLISH_SSI_BUFLEN - strlen(args));
879879
VerifyOrReturnError(ret == CHIP_NO_ERROR, ret);
880880
ChipLogProgress(DeviceLayer, "WiFi-PAF: publish: [%s]", args);
881+
std::lock_guard<std::mutex> lock(mWpaSupplicantMutex);
881882
wpa_fi_w1_wpa_supplicant1_interface_call_nanpublish_sync(mWpaSupplicant.iface, args, &publish_id, nullptr, &err.GetReceiver());
882883
ChipLogProgress(DeviceLayer, "WiFi-PAF: publish_id: %d ! ", publish_id);
883884

@@ -896,6 +897,7 @@ CHIP_ERROR ConnectivityManagerImpl::_WiFiPAFCancelPublish()
896897

897898
ChipLogProgress(DeviceLayer, "WiFi-PAF: cancel publish_id: %d ! ", mpaf_info.peer_publish_id);
898899
snprintf(args, sizeof(args), "publish_id=%d", mpaf_info.peer_publish_id);
900+
std::lock_guard<std::mutex> lock(mWpaSupplicantMutex);
899901
wpa_fi_w1_wpa_supplicant1_interface_call_nancancel_publish_sync(mWpaSupplicant.iface, args, nullptr, &err.GetReceiver());
900902
return CHIP_NO_ERROR;
901903
}
@@ -1483,6 +1485,7 @@ CHIP_ERROR ConnectivityManagerImpl::_WiFiPAFConnect(const SetupDiscriminator & c
14831485
VerifyOrReturnError(ret == CHIP_NO_ERROR, ret);
14841486
ChipLogProgress(DeviceLayer, "WiFi-PAF: subscribe: [%s]", args);
14851487

1488+
std::lock_guard<std::mutex> lock(mWpaSupplicantMutex);
14861489
wpa_fi_w1_wpa_supplicant1_interface_call_nansubscribe_sync(mWpaSupplicant.iface, args, &subscribe_id, nullptr,
14871490
&err.GetReceiver());
14881491
ChipLogProgress(DeviceLayer, "WiFi-PAF: subscribe_id: [%d]", subscribe_id);
@@ -1519,6 +1522,7 @@ CHIP_ERROR ConnectivityManagerImpl::_WiFiPAFCancelConnect()
15191522
gchar args[MAX_PAF_PUBLISH_SSI_BUFLEN];
15201523

15211524
snprintf(args, sizeof(args), "subscribe_id=%d", mpresubscribe_id);
1525+
std::lock_guard<std::mutex> lock(mWpaSupplicantMutex);
15221526
wpa_fi_w1_wpa_supplicant1_interface_call_nancancel_subscribe_sync(mWpaSupplicant.iface, args, nullptr, &err.GetReceiver());
15231527
mOnPafSubscribeComplete = nullptr;
15241528
mOnPafSubscribeError = nullptr;
@@ -1573,6 +1577,7 @@ CHIP_ERROR ConnectivityManagerImpl::_WiFiPAFSend(System::PacketBufferHandle && m
15731577
MAX_PAF_TX_SSI_BUFLEN - strlen(args));
15741578
VerifyOrReturnError(ret == CHIP_NO_ERROR, ret);
15751579
ChipLogProgress(DeviceLayer, "WiFi-PAF: ssi: [%s]", args);
1580+
std::lock_guard<std::mutex> lock(mWpaSupplicantMutex);
15761581
wpa_fi_w1_wpa_supplicant1_interface_call_nantransmit_sync(mWpaSupplicant.iface, args, nullptr, &err.GetReceiver());
15771582
ChipLogProgress(Controller, "WiFi-PAF: Outbound message (%lu) done", msgBuf->DataLength());
15781583
return ret;

0 commit comments

Comments
 (0)