diff options
author | Kai Shi <kaishi@google.com> | 2020-02-12 13:43:19 -0800 |
---|---|---|
committer | Kai Shi <kaishi@google.com> | 2020-02-12 13:51:52 -0800 |
commit | 990435711bb3917cfe92ada2f6a09224aed5356a (patch) | |
tree | fcf2e9ba27a1f712fe019c7c3abbe34b2f52468a /service | |
parent | 145f07c0fe0f60f0d13886a20ce47c8a41081712 (diff) |
Add one more boundary check of maxNumSpatialStream
Due to the missing NL80211 PHY attribute parsing and incorrect
initialization of BandInfo in wificond, throughputPredictor's
maxNumSpatialStream is set to 0 which results in 0 Mbps throughput
To avoid similar issue due to incorrect implementation of wificond
or WifiHAL, add a safety check in throughputPredictor to ensure
maxNumSpatialStream >= 1.
Bug: 149415717
Test: atest com.android.server.wifi
Change-Id: Ib19a897d3fadfe4f43bbfa2522b2f971ea90f588
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/ThroughputPredictor.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/ThroughputPredictor.java b/service/java/com/android/server/wifi/ThroughputPredictor.java index 8cda4c288..80df9aa43 100644 --- a/service/java/com/android/server/wifi/ThroughputPredictor.java +++ b/service/java/com/android/server/wifi/ThroughputPredictor.java @@ -228,6 +228,10 @@ public class ThroughputPredictor { int numTonePerSym; int symDurationNs; int maxBitsPerTone; + if (maxNumSpatialStream < 1) { + Log.e(TAG, "maxNumSpatialStream < 1 due to wrong implementation. Overridden to 1"); + maxNumSpatialStream = 1; + } if (wifiStandard == ScanResult.WIFI_STANDARD_UNKNOWN) { return WifiInfo.LINK_SPEED_UNKNOWN; } else if (wifiStandard == ScanResult.WIFI_STANDARD_LEGACY) { |