Skip to content

Commit bb288d7

Browse files
techyguyperplexablemhiramat
authored andcommitted
lib/bootconfig: check xbc_init_node() return in override path
The ':=' override path in xbc_parse_kv() calls xbc_init_node() to re-initialize an existing value node but does not check the return value. If xbc_init_node() fails (data offset out of range), parsing silently continues with stale node data. Add the missing error check to match the xbc_add_node() call path which already checks for failure. In practice, a bootconfig using ':=' to override a value near the 32KB data limit could silently retain the old value, meaning a security-relevant boot parameter override (e.g., a trace filter or debug setting) would not take effect as intended. Link: https://lore.kernel.org/all/[email protected]/ Fixes: e5efaeb ("bootconfig: Support mixing a value and subkeys under a key") Signed-off-by: Josh Law <[email protected]> Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
1 parent f338e77 commit bb288d7

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

lib/bootconfig.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,8 @@ static int __init xbc_parse_kv(char **k, char *v, int op)
723723
if (op == ':') {
724724
unsigned short nidx = child->next;
725725

726-
xbc_init_node(child, v, XBC_VALUE);
726+
if (xbc_init_node(child, v, XBC_VALUE) < 0)
727+
return xbc_parse_error("Failed to override value", v);
727728
child->next = nidx; /* keep subkeys */
728729
goto array;
729730
}

0 commit comments

Comments
 (0)