|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] xen/common: llc-coloring: clear color count on parse failure
commit 16558646c8464ee32891096bf2d962b7e7213769
Author: Mykola Kvach <mykola_kvach@xxxxxxxx>
AuthorDate: Thu May 21 21:41:21 2026 +0300
Commit: Michal Orzel <michal.orzel@xxxxxxx>
CommitDate: Mon May 25 12:49:54 2026 +0200
xen/common: llc-coloring: clear color count on parse failure
parse_color_config() updates the caller-provided color count while
parsing. If parsing later fails, leave the count at zero so callers
do not consume a partially parsed configuration.
The bug is reachable in practice: cmdline_parse() ignores the -EINVAL
from a custom_param callback, so boot continues with the partial
xen_num_colors / dom0_num_colors that llc_coloring_init() and
dom0_set_llc_colors() then consume.
Fixes: 6cdea3444eaf ("xen/arm: add Dom0 cache coloring support")
Signed-off-by: Mykola Kvach <mykola_kvach@xxxxxxxx>
Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>
Reviewed-by: Denis Mukhin <dmukhin@xxxxxxxx>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
---
xen/common/llc-coloring.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/xen/common/llc-coloring.c b/xen/common/llc-coloring.c
index 6dc614739a..2606cb0977 100644
--- a/xen/common/llc-coloring.c
+++ b/xen/common/llc-coloring.c
@@ -79,7 +79,7 @@ static int __init parse_color_config(const char *buf,
unsigned int colors[],
if ( end >= NR_LLC_COLORS || start > end ||
(end - start) >= (UINT_MAX - *num_colors) ||
(*num_colors + (end - start)) >= max_num_colors )
- return -EINVAL;
+ goto fail;
/* Colors are range checked in check_colors() */
for ( color = start; color <= end; color++ )
@@ -91,7 +91,14 @@ static int __init parse_color_config(const char *buf,
unsigned int colors[],
break;
}
- return *s ? -EINVAL : 0;
+ if ( *s )
+ goto fail;
+
+ return 0;
+
+ fail:
+ *num_colors = 0;
+ return -EINVAL;
}
static int __init parse_dom0_colors(const char *s)
--
generated by git-patchbot for /home/xen/git/xen.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |