Android security tags, read closely by Lightrion

CVE-2023-40114 AI-generated analysis

platform/frameworks/av, media/mtp (MtpFfsHandle, FunctionFS MTP transport)

AI-generated: written from the bulletin and the fixing diffs by claude-fable-5-1, then checked against the code by claude-opus-5-5 (4 corrections). Verify against the commit before relying on it.

Adds a mutex, condition variable and atomic child-thread counter to MtpFfsHandle so that close() waits (up to 2 seconds) for detached doSendEvent threads spawned by sendEvent() to finish before the handle is torn down, preventing a heap use-after-free of the handle's members from the detached thread.

Root cause

MtpFfsHandle::sendEvent() copies the event payload and launches a std::thread running this->doSendEvent(me), then immediately detaches it. Nothing tracked that thread's lifetime, so MtpFfsHandle::close() and the subsequent freeing of the MtpFfsHandle object could proceed while doSendEvent was still running and still accessing data members of the object (the commit message says a data member was accessed after the object was freed, as found by the mtp_handle_fuzzer).

How the fix works

Completeness

Behavior changes

Per major

Unknowns

Back to November 2023 · Findings