MountService: Fix bug which would allow apps to try to rename a container whos dst is mounted
Signed-off-by: San Mehat <san@google.com>
diff --git a/services/java/com/android/server/MountService.java b/services/java/com/android/server/MountService.java
index 39ee314..2dc12f6 100644
--- a/services/java/com/android/server/MountService.java
+++ b/services/java/com/android/server/MountService.java
@@ -1003,7 +1003,11 @@
warnOnNotMounted();
synchronized (mAsecMountSet) {
- if (mAsecMountSet.contains(oldId)) {
+ /*
+ * Because a mounted container has active internal state which cannot be
+ * changed while active, we must ensure both ids are not currently mounted.
+ */
+ if (mAsecMountSet.contains(oldId) || mAsecMountSet.contains(newId)) {
return StorageResultCode.OperationFailedStorageMounted;
}
}