summaryrefslogtreecommitdiff
path: root/drivers/android/binder/thread.rs
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/android/binder/thread.rs')
-rw-r--r--drivers/android/binder/thread.rs31
1 files changed, 12 insertions, 19 deletions
diff --git a/drivers/android/binder/thread.rs b/drivers/android/binder/thread.rs
index f5965e838a96..4ce6fc533203 100644
--- a/drivers/android/binder/thread.rs
+++ b/drivers/android/binder/thread.rs
@@ -1332,20 +1332,16 @@ impl Thread {
self.transaction_inner(&mut info)
};
- // This runs when return work is passed to the caller. This is not
- // always the same as the transaction failing, as reply errors are
- // delivered to the remote process.
+ // This runs when a transaction fails with an error returned to the caller.
if let Err(err) = ret {
self.push_return_work(err.reply);
- if err.reply != BR_TRANSACTION_COMPLETE {
- info.reply = err.reply;
- info.error_line = Some(err.line);
- if let Some(source) = err.source {
- info.errno = Some(source);
+ info.reply = err.reply;
+ info.error_line = Some(err.line);
+ if let Some(source) = err.source {
+ info.errno = Some(source);
- self.inner.lock().extended_error =
- ExtendedError::new(info.debug_id as u32, err.reply, source.to_errno());
- }
+ self.inner.lock().extended_error =
+ ExtendedError::new(info.debug_id as u32, err.reply, source.to_errno());
}
}
@@ -1450,7 +1446,7 @@ impl Thread {
info.to_pid = orig.from.process.task.pid();
// We need to complete the transaction even if we cannot complete building the reply.
- let out = (|| -> BinderResult<_> {
+ if let Err(err) = (|| -> BinderResult<_> {
let completion = DTRWrap::arc_try_new(DeliverCode::new(
BR_TRANSACTION_COMPLETE,
self.process.task.pid(),
@@ -1471,11 +1467,10 @@ impl Thread {
}
orig.from.deliver_reply(Ok(reply), &orig, None);
Ok(())
- })()
- .map_err(|mut err| {
+ })() {
// At this point we only return `BR_TRANSACTION_COMPLETE` to the caller, and we must let
// the sender know that the transaction has completed (with an error in this case).
-
+ self.push_return_work(BR_TRANSACTION_COMPLETE);
let param = err.source.as_ref().map_or(0, |e| e.to_errno());
let ee = ExtendedError::new(info.debug_id as u32, err.reply, param);
orig.from
@@ -1483,11 +1478,9 @@ impl Thread {
info.reply = BR_FAILED_REPLY;
info.errno = err.source;
info.error_line = Some(err.line);
- err.reply = BR_TRANSACTION_COMPLETE;
- err
- });
+ }
- out
+ Ok(())
}
fn oneway_transaction_inner(self: &Arc<Self>, info: &mut TransactionInfo) -> BinderResult {