From 806de232ff2a295ef27ff4450e4bdf5e989528bd Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Tue, 1 Aug 2017 17:08:40 -0700 Subject: WifiStateMachine: Always return a copy of WifiInfo WifiStateMachine#syncRequestConnectionInfo() should always return a copy of WifiInfo to prevent external services directly accessing a local variable in WifiStateMachine. Binder calls within the same process doesn't parcel objects, hence this is needed to prevent other threads in system_server directly using a local object within the wifi service. Bug: 64207440 Test: Unit test that checks for object returned from WifiStateMachine#getWifiInfo() vs WifiStateMachine#syncRequestConnectionInfo(). Change-Id: I3d709a09d3d10a1d133fd79eeee430830eb008b2 Merged-In: I3d709a09d3d10a1d133fd79eeee430830eb008b2 --- service/java/com/android/server/wifi/WifiStateMachine.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'service') diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java index e4abc96bb..1161d587f 100644 --- a/service/java/com/android/server/wifi/WifiStateMachine.java +++ b/service/java/com/android/server/wifi/WifiStateMachine.java @@ -3139,11 +3139,11 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss } private WifiInfo getWiFiInfoForUid(int uid) { + WifiInfo result = new WifiInfo(mWifiInfo); if (Binder.getCallingUid() == Process.myUid()) { - return mWifiInfo; + return result; } - WifiInfo result = new WifiInfo(mWifiInfo); result.setMacAddress(WifiInfo.DEFAULT_MAC_ADDRESS); IBinder binder = mFacade.getService("package"); -- cgit v1.2.3