From d183457586db509753e5b87c91b8c584fe5a53d3 Mon Sep 17 00:00:00 2001 From: Purushottam Kushwaha Date: Fri, 5 Jun 2020 15:16:58 +0530 Subject: 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 --- service/java/com/android/server/wifi/HalDeviceManager.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'service') 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; + } } /** -- cgit v1.2.3