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

Commit a9249b23 authored by Edwin Wong's avatar Edwin Wong
Browse files

[RESTRICT AUTOMERGE] Fix double free of play policy in a race condition.

The mPlayPolicy can be freed twice if there is a race condition.
mPlayPolicy should be protected with a mutex lock.

SafetyNet logging is not added to avoid log spamming. The
mutex lock is called whenever a license request is made.
That can happen quite often.

Bug: 176168330

Test: TreeHugger build
Change-Id: Idccbc768c17676087dd66fcdd568bac402202e8f
parent f34c91d2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ status_t DrmPlugin::getKeyRequest(
}

void DrmPlugin::setPlayPolicy() {
    android::Mutex::Autolock lock(mPlayPolicyLock);
    mPlayPolicy.clear();
    mPlayPolicy.add(kQueryKeyLicenseType, kStreaming);
    mPlayPolicy.add(kQueryKeyPlayAllowed, kTrue);
+1 −0
Original line number Diff line number Diff line
@@ -244,6 +244,7 @@ public:
private:
    void setPlayPolicy();

    android::Mutex mPlayPolicyLock;
    android::KeyedVector<android::String8, android::String8> mPlayPolicy;
    SessionLibrary* mSessionLibrary;