diff options
author | 2020-12-29 22:51:32 +0000 | |
---|---|---|
committer | 2020-12-29 23:31:24 +0000 | |
commit | 4da8fb0f71b87d53e4b63fcc5671847d03982317 (patch) | |
tree | b041f39c84ad39b89bed9cffd821598be03e44ef /libs/binder/ProcessState.cpp | |
parent | 5605b245e40ba245709116d941192cfcf0a2b2da (diff) |
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
Diffstat (limited to 'libs/binder/ProcessState.cpp')
-rw-r--r-- | libs/binder/ProcessState.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp index 6f26450275..b5e4dfe4df 100644 --- a/libs/binder/ProcessState.cpp +++ b/libs/binder/ProcessState.cpp @@ -124,14 +124,14 @@ 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()); } - // 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()); - return context; } |