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

Commit 4da8fb0f authored by Steven Moreland's avatar Steven Moreland
Browse files

libbinder: only set sm stability if non-null

These mark*Stability functions actually abort for the nullptr case, but
when SM crashes, we'll get a null proxy here, and aborts everywhere
(instead of waiting in other processes).

Bug: one flake in binder_parcel_fuzzer weeks ago and more recently,
    discovered in some failure logs from kaleshsingh@
Test: manual (with crash in flattenBinder in SM)
Change-Id: I89787127d836d18d343161881dff6b156c2dc482
parent 5605b245
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -124,13 +124,13 @@ sp<IBinder> ProcessState::getContextObject(const sp<IBinder>& /*caller*/)
{
    sp<IBinder> context = getStrongProxyForHandle(0);

    if (context == nullptr) {
       ALOGW("Not able to get context object on %s.", mDriverName.c_str());
    }

    if (context) {
        // The root object is special since we get it directly from the driver, it is never
        // written by Parcell::writeStrongBinder.
        internal::Stability::markCompilationUnit(context.get());
    } else {
        ALOGW("Not able to get context object on %s.", mDriverName.c_str());
    }

    return context;
}