Fix multi-link llstat parsing in wifi legacy hal
Multi-link llstat parsing codes in wifi legacy hal, specifically
'copyLinkStat' and 'copyPeerInfo', pass the output container parameter
'std::vector<>' by value instead of by reference. The result is the
copied 'LinkStats' list and 'WifiPeerInfo' list are discarded when
'copyLinkStat' and 'copyPeerInfo' return. The empty links list are
passed to framework and fails validity check in Wi-Fi framework and
leads to system server crash.
Fix this issue by passing 'stats' and 'peers' by reference.
Bug: 269049672
Test: Manual Test with multi-link llstat implementation integrated
Change-Id: If8c366213af2ffcb9f7b3c904e1541ed0ac2fea4
diff --git a/wifi/aidl/default/wifi_legacy_hal.cpp b/wifi/aidl/default/wifi_legacy_hal.cpp
index 43a71cc..5e64b85 100644
--- a/wifi/aidl/default/wifi_legacy_hal.cpp
+++ b/wifi/aidl/default/wifi_legacy_hal.cpp
@@ -745,7 +745,7 @@
// Copies wifi_peer_info* to vector<WifiPeerInfo> and returns poiner to next element.
wifi_peer_info* WifiLegacyHal::copyPeerInfo(wifi_peer_info* peer_ptr,
- std::vector<WifiPeerInfo> peers) {
+ std::vector<WifiPeerInfo>& peers) {
WifiPeerInfo peer;
peer.peer_info = *peer_ptr;
if (peer_ptr->num_rate > 0) {
@@ -761,7 +761,7 @@
}
// Copies wifi_link_stat* to vector<LinkStats> and returns poiner to next element.
wifi_link_stat* WifiLegacyHal::copyLinkStat(wifi_link_stat* stat_ptr,
- std::vector<LinkStats> stats) {
+ std::vector<LinkStats>& stats) {
LinkStats linkStat;
linkStat.stat = *stat_ptr;
wifi_peer_info* l_peer_info_stats_ptr = stat_ptr->peer_info;