Patch incoming LinkProperties before it's visible to the outside
Otherwise we risk a race condition when we are fixing the LinkProperties routes, other parts of ConnectivityService is reading the field at the same time. Test: runtest frameworks-net -c com.android.server.ConnectivityServiceTest Test: runtest frameworks-core -c android.net.LinkPropertiesTest Bug: 65529483 Bug: 35995111 (cherry picked from commit 6c1f6fd78927514df73ddace81edac4899c4cda4) Change-Id: I539578703570a901e0a5dff0155422ca78c52401
This commit is contained in:
parent
70b9208871
commit
599db833bb
1 changed files with 2 additions and 3 deletions
|
|
@ -4649,7 +4649,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||
// Ignore updates for disconnected networks
|
||||
return;
|
||||
}
|
||||
|
||||
// newLp is already a defensive copy.
|
||||
newLp.ensureDirectlyConnectedRoutes();
|
||||
if (VDBG) {
|
||||
log("Update of LinkProperties for " + nai.name() +
|
||||
"; created=" + nai.created +
|
||||
|
|
@ -4659,8 +4660,6 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||
synchronized (nai) {
|
||||
nai.linkProperties = newLp;
|
||||
}
|
||||
// msg.obj is already a defensive copy.
|
||||
nai.linkProperties.ensureDirectlyConnectedRoutes();
|
||||
if (nai.everConnected) {
|
||||
updateLinkProperties(nai, oldLp);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue