summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorPurushottam Kushwaha <quic_pkushwah@quicinc.com>2020-06-05 15:16:58 +0530
committerRoshan Pius <rpius@google.com>2020-06-06 22:19:11 +0000
commitd183457586db509753e5b87c91b8c584fe5a53d3 (patch)
tree9ddcc1366b2a5cfa1edd8f04d6e648fb8712dc6b /service
parentf50a7427bfcfe18e20c2c1ef64295e1d2293f91d (diff)
HDM: Prevent race condition by guarding with lock.
HalDeviceManager.mWifi is shared resource for various wifi modules (threads). Acquire lock before using it. (cherry-picked from go/pag/1694045) Bug: 158276067 Test: atest com.android.server.wifi Change-Id: I2e7763fa5e0da43ece5862b5e2c787eb1df572b5 Signed-off-by: Purushottam Kushwaha <quic_pkushwah@quicinc.com>
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/HalDeviceManager.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/service/java/com/android/server/wifi/HalDeviceManager.java b/service/java/com/android/server/wifi/HalDeviceManager.java
index 783c91adf..3d0c89c4a 100644
--- a/service/java/com/android/server/wifi/HalDeviceManager.java
+++ b/service/java/com/android/server/wifi/HalDeviceManager.java
@@ -179,7 +179,9 @@ public class HalDeviceManager {
*/
public void stop() {
stopWifi();
- mWifi = null;
+ synchronized (mLock) { // prevents race condition
+ mWifi = null;
+ }
}
/**