From e7a034a56fc1eeecfe30d374a70793cf22824eee Mon Sep 17 00:00:00 2001 From: zhanghao56 Date: Tue, 13 May 2025 16:23:13 +0800 Subject: [PATCH] ANDROID: binder: fix minimum node priority comparison The "desired" priority for a transaction can be adjusted depending on various factors. For instance, it might be set to SCHED_NORMAL 120, when the caller is RT and the target node has !inherit_rt. However, instead of using these adjustments, the existing logic compares the minimum node priority against the original transaction priority. If the transaction priority is "higher", then the minimum node priority is ignored. This is particularly a problem when the "desired" priority has been changed to SCHED_NORMAL. This patch corrects the logic, comparing the minimum node priority against the (potentially adjusted) "desired" priority. This guarantees that the node's minimum priority is honored. Bug: 417382411 Cc: Martijn Coenen Fixes: c46810c23565 ("ANDROID: binder: add RT inheritance flag to node.") Change-Id: I813073241b996c1c38c29f20849b247023697102 Signed-off-by: zhanghao56 Signed-off-by: Carlos Llamas --- drivers/android/binder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index f29ad0e598c1..8b30f5e3bbe7 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -827,8 +827,8 @@ static void binder_transaction_priority(struct binder_thread *thread, desired.sched_policy = SCHED_NORMAL; } - if (node_prio.prio < t->priority.prio || - (node_prio.prio == t->priority.prio && + if (node_prio.prio < desired.prio || + (node_prio.prio == desired.prio && node_prio.sched_policy == SCHED_FIFO)) { /* * In case the minimum priority on the node is