Files
linux-stable-mirror/lib
Josh Law f6f380b746 lib/bootconfig: check bounds before writing in __xbc_open_brace()
commit 560f763baa upstream.

The bounds check for brace_index happens after the array write.
While the current call pattern prevents an actual out-of-bounds
access (the previous call would have returned an error), the
write-before-check pattern is fragile and would become a real
out-of-bounds write if the error return were ever not propagated.

Move the bounds check before the array write so the function is
self-contained and safe regardless of caller behavior.

Link: https://lore.kernel.org/all/20260312191143.28719-3-objecting@objecting.org/

Fixes: ead1e19ad9 ("lib/bootconfig: Fix a bug of breaking existing tree nodes")
Cc: stable@vger.kernel.org
Signed-off-by: Josh Law <objecting@objecting.org>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-04-18 10:33:16 +02:00
..
2024-07-18 13:07:29 +02:00
2024-10-17 15:10:56 +02:00
2025-10-19 16:21:28 +02:00
2022-06-22 14:22:03 +02:00
2022-06-22 14:22:03 +02:00