Skip to content

Commit bfe144d

Browse files
Darksonngregkh
authored andcommitted
rust_binder: freeze_notif_done should resend if wrong state
Consider the following scenario: 1. A freeze notification is delivered to thread 1. 2. The process becomes frozen or unfrozen. 3. The message for step 2 is delivered to thread 2 and ignored because there is already a pending notification from step 1. 4. Thread 1 acknowledges the notification from step 1. In this case, step 4 should ensure that the message ignored in step 3 is resent as it can now be delivered. Signed-off-by: Alice Ryhl <[email protected]> Acked-by: Carlos Llamas <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent c7c090a commit bfe144d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/android/binder/freeze.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,9 @@ impl Process {
245245
);
246246
return Err(EINVAL);
247247
}
248-
if freeze.is_clearing {
249-
// Immediately send another FreezeMessage for BR_CLEAR_FREEZE_NOTIFICATION_DONE.
248+
let is_frozen = freeze.node.owner.inner.lock().is_frozen;
249+
if freeze.is_clearing || freeze.last_is_frozen != Some(is_frozen) {
250+
// Immediately send another FreezeMessage.
250251
clear_msg = Some(FreezeMessage::init(alloc, cookie));
251252
}
252253
freeze.is_pending = false;

0 commit comments

Comments
 (0)