From: "tip-bot2 for Levi Yun" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Levi Yun <ppbuk5246@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
"Anna-Maria Behnsen" <anna-maria@linutronix.de>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: timers/urgent] timers/migration: Prevent out of bounds access on failure
Date: Wed, 08 May 2024 09:45:41 -0000 [thread overview]
Message-ID: <171516154125.10875.14125964308560203288.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20240506041059.86877-1-ppbuk5246@gmail.com>
The following commit has been merged into the timers/urgent branch of tip:
Commit-ID: d7ad05c86e2191bd66e5b62fca8da53c4a53484f
Gitweb: https://git.kernel.org/tip/d7ad05c86e2191bd66e5b62fca8da53c4a53484f
Author: Levi Yun <ppbuk5246@gmail.com>
AuthorDate: Mon, 06 May 2024 05:10:59 +01:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Wed, 08 May 2024 11:19:43 +02:00
timers/migration: Prevent out of bounds access on failure
When tmigr_setup_groups() fails the level 0 group allocation, then the
cleanup derefences index -1 of the local stack array.
Prevent this by checking the loop condition first.
Fixes: 7ee988770326 ("timers: Implement the hierarchical pull model")
Signed-off-by: Levi Yun <ppbuk5246@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Anna-Maria Behnsen <anna-maria@linutronix.de>
Link: https://lore.kernel.org/r/20240506041059.86877-1-ppbuk5246@gmail.com
---
kernel/time/timer_migration.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/time/timer_migration.c b/kernel/time/timer_migration.c
index ccba875..8441311 100644
--- a/kernel/time/timer_migration.c
+++ b/kernel/time/timer_migration.c
@@ -1596,7 +1596,7 @@ static int tmigr_setup_groups(unsigned int cpu, unsigned int node)
} while (i < tmigr_hierarchy_levels);
- do {
+ while (i > 0) {
group = stack[--i];
if (err < 0) {
@@ -1645,7 +1645,7 @@ static int tmigr_setup_groups(unsigned int cpu, unsigned int node)
tmigr_connect_child_parent(child, group);
}
}
- } while (i > 0);
+ }
kfree(stack);
next prev parent reply other threads:[~2024-05-08 9:45 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-01 19:51 [PATCH] time/timgr: Fix wrong reference when level 0 group allocation failed Levi Yun
2024-05-04 4:47 ` Yun Levi
2024-05-04 10:09 ` Markus Elfring
2024-05-05 8:57 ` [PATCH RESEND] " Levi Yun
2024-05-05 10:23 ` Markus Elfring
2024-05-05 10:55 ` Yun Levi
2024-05-05 10:54 ` [PATCH v2] " Levi Yun
2024-05-05 17:07 ` [v2] " Markus Elfring
2024-05-06 4:10 ` [PATCH v3] " Levi Yun
2024-05-06 10:10 ` Frederic Weisbecker
2024-05-08 6:16 ` Anna-Maria Behnsen
2024-05-08 6:38 ` [v3] " Markus Elfring
2024-05-08 9:45 ` tip-bot2 for Levi Yun [this message]
2024-05-08 9:57 ` [tip: timers/urgent] timers/migration: Prevent out of bounds access on failure Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=171516154125.10875.14125964308560203288.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=anna-maria@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=ppbuk5246@gmail.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®