From 60f1e8cbb495704345d11dbf348f05e9191bc5d0 Mon Sep 17 00:00:00 2001 From: Lorenzo Colitti Date: Tue, 13 Oct 2015 15:21:21 +0900 Subject: [PATCH] Don't crash if an invalid always-on VPN profile is configured. This is currently being hit because Settings does not clear the always-on VPN configuration when the corresponding VPN profile is deleted. This will be fixed in Settings, but there's no harm in being robust to invalid configurations here. Bug: 23625458 Change-Id: Id185a54d5892339197cd40026df5174debd957cf --- .../core/java/com/android/server/ConnectivityService.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index 6190a5ab35..d715654144 100644 --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java @@ -3212,6 +3212,11 @@ public class ConnectivityService extends IConnectivityManager.Stub final String profileName = new String(mKeyStore.get(Credentials.LOCKDOWN_VPN)); final VpnProfile profile = VpnProfile.decode( profileName, mKeyStore.get(Credentials.VPN + profileName)); + if (profile == null) { + Slog.e(TAG, "Lockdown VPN configured invalid profile " + profileName); + setLockdownTracker(null); + return true; + } int user = UserHandle.getUserId(Binder.getCallingUid()); synchronized(mVpns) { setLockdownTracker(new LockdownVpnTracker(mContext, mNetd, this, mVpns.get(user),