Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b446cbb6 authored by Scott Mertz's avatar Scott Mertz Committed by Gerrit Code Review
Browse files

MountService: ensure VolumeRecord with UUID exists before modifying

A client (SystemUI) can pass in a fs UUID that doesn't exist in the
records.  Guard against this invalid input.

Change-Id: I74666c1cdd56a13efa84385b387ccb3a5d68dfc2
parent 9a8df5bc
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1742,6 +1742,8 @@ class MountService extends IMountService.Stub
        Preconditions.checkNotNull(fsUuid);
        synchronized (mLock) {
            final VolumeRecord rec = mRecords.get(fsUuid);
            if (rec == null)
                return;
            rec.nickname = nickname;
            mCallbacks.notifyVolumeRecordChanged(rec);
            writeSettingsLocked();
@@ -1756,6 +1758,8 @@ class MountService extends IMountService.Stub
        Preconditions.checkNotNull(fsUuid);
        synchronized (mLock) {
            final VolumeRecord rec = mRecords.get(fsUuid);
            if (rec == null)
                return;
            rec.userFlags = (rec.userFlags & ~mask) | (flags & mask);
            mCallbacks.notifyVolumeRecordChanged(rec);
            writeSettingsLocked();