mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-18 15:19:38 +02:00
ANDROID: rust_binder: return pending info for frozen async txns
When a transaction is queued due to being a oneway transaction to a frozen process, we currently just return success. Instead, report a BR_TRANSACTION_PENDING_FROZEN code so that userspace knows that its transaction is queued for a frozen process. Bug: 333852369 Link: https://lore.kernel.org/r/20221123201654.589322-1-dualli@chromium.org Change-Id: Ib3f2773872f431aad564b439bc2d1cdb02ae4b29 Signed-off-by: Alice Ryhl <aliceryhl@google.com>
This commit is contained in:
parent
f7562fbffd
commit
c9370a3cbb
|
@ -26,6 +26,7 @@ pub_no_prefix!(
|
||||||
BR_NOOP,
|
BR_NOOP,
|
||||||
BR_SPAWN_LOOPER,
|
BR_SPAWN_LOOPER,
|
||||||
BR_TRANSACTION_COMPLETE,
|
BR_TRANSACTION_COMPLETE,
|
||||||
|
BR_TRANSACTION_PENDING_FROZEN,
|
||||||
BR_ONEWAY_SPAM_SUSPECT,
|
BR_ONEWAY_SPAM_SUSPECT,
|
||||||
BR_OK,
|
BR_OK,
|
||||||
BR_ERROR,
|
BR_ERROR,
|
||||||
|
|
|
@ -30,6 +30,13 @@ impl BinderError {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn new_frozen_oneway() -> Self {
|
||||||
|
Self {
|
||||||
|
reply: BR_TRANSACTION_PENDING_FROZEN,
|
||||||
|
source: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) fn is_dead(&self) -> bool {
|
pub(crate) fn is_dead(&self) -> bool {
|
||||||
self.reply == BR_DEAD_REPLY
|
self.reply == BR_DEAD_REPLY
|
||||||
}
|
}
|
||||||
|
@ -86,6 +93,7 @@ impl core::fmt::Debug for BinderError {
|
||||||
},
|
},
|
||||||
BR_DEAD_REPLY => f.pad("BR_DEAD_REPLY"),
|
BR_DEAD_REPLY => f.pad("BR_DEAD_REPLY"),
|
||||||
BR_FROZEN_REPLY => f.pad("BR_FROZEN_REPLY"),
|
BR_FROZEN_REPLY => f.pad("BR_FROZEN_REPLY"),
|
||||||
|
BR_TRANSACTION_PENDING_FROZEN => f.pad("BR_TRANSACTION_PENDING_FROZEN"),
|
||||||
BR_TRANSACTION_COMPLETE => f.pad("BR_TRANSACTION_COMPLETE"),
|
BR_TRANSACTION_COMPLETE => f.pad("BR_TRANSACTION_COMPLETE"),
|
||||||
_ => f
|
_ => f
|
||||||
.debug_struct("BinderError")
|
.debug_struct("BinderError")
|
||||||
|
|
|
@ -282,7 +282,7 @@ impl Transaction {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
match target_node.submit_oneway(self, &mut process_inner) {
|
match target_node.submit_oneway(self, &mut process_inner) {
|
||||||
Ok(()) => return Ok(()),
|
Ok(()) => {}
|
||||||
Err((err, work)) => {
|
Err((err, work)) => {
|
||||||
drop(process_inner);
|
drop(process_inner);
|
||||||
// Drop work after releasing process lock.
|
// Drop work after releasing process lock.
|
||||||
|
@ -290,6 +290,12 @@ impl Transaction {
|
||||||
return Err(err);
|
return Err(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if process_inner.is_frozen {
|
||||||
|
return Err(BinderError::new_frozen_oneway());
|
||||||
|
} else {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
pr_err!("Failed to submit oneway transaction to node.");
|
pr_err!("Failed to submit oneway transaction to node.");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user