diff options
author | Yohei Yukawa <yukawa@google.com> | 2018-12-09 22:58:57 -0800 |
---|---|---|
committer | Yohei Yukawa <yukawa@google.com> | 2018-12-09 22:58:57 -0800 |
commit | 91e6cd0b5dcf4037d16b3e16411472bdb53514e2 (patch) | |
tree | dfe625d29ef50f2cbac32c3945e37411823eaf0f /rs/java/android/renderscript/ProgramStore.java | |
parent | ca2d3b6c5f2a4e4bf99b11eb6c074c4d0519c42a (diff) |
Make sure caller verification is done inside a lock
This caller verification needs to be done in an atomic manner. There
is a possible race condition in the following code.
@BinderThread
public boolean doSomething() {
if (!calledFromValidUser()) {
return false;
}
// possible race condition here.
synchronized(mMethodMap) {
// actual operations
}
}
Insted, we should check the caller after taking a lock.
@BinderThread
public boolean doSomething() {
synchronized(mMethodMap) {
if (!calledFromValidUserLocked()) {
return false;
}
// actual operations
}
}
Bug: 34886274
Test: atest CtsInputMethodTestCases CtsInputMethodServiceHostTestCases
Change-Id: I02df0307ce2aecc77de8fb2afaa39e5ecf8f3fe2
Diffstat (limited to 'rs/java/android/renderscript/ProgramStore.java')
0 files changed, 0 insertions, 0 deletions