vold2: Don't allow containers < 1mb, and clean up some logging
Signed-off-by: San Mehat <san@google.com>
diff --git a/VolumeManager.cpp b/VolumeManager.cpp
index b21a36e..251e11c 100644
--- a/VolumeManager.cpp
+++ b/VolumeManager.cpp
@@ -171,6 +171,12 @@
int VolumeManager::createAsec(const char *id, unsigned int numSectors,
const char *fstype, const char *key, int ownerUid) {
+ if (numSectors < ((1024*1024)/512)) {
+ LOGE("Invalid container size specified (%d sectors)", numSectors);
+ errno = EINVAL;
+ return -1;
+ }
+
mkdir("/sdcard/android_secure", 0777);
if (lookupVolume(id)) {