Merge tag 'bootconfig-fixes-v7.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace

Pull bootconfig fixes from Masami Hiramatsu:

 - Check error code of xbc_init_node() in override value path in
   xbc_parse_kv()

 - Fix fd leak in load_xbc_file() on fstat failure

* tag 'bootconfig-fixes-v7.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
  tools/bootconfig: fix fd leak in load_xbc_file() on fstat failure
  lib/bootconfig: check xbc_init_node() return in override path
This commit is contained in:
Linus Torvalds
2026-03-21 08:46:13 -07:00
2 changed files with 7 additions and 3 deletions

View File

@@ -723,7 +723,8 @@ static int __init xbc_parse_kv(char **k, char *v, int op)
if (op == ':') {
unsigned short nidx = child->next;
xbc_init_node(child, v, XBC_VALUE);
if (xbc_init_node(child, v, XBC_VALUE) < 0)
return xbc_parse_error("Failed to override value", v);
child->next = nidx; /* keep subkeys */
goto array;
}

View File

@@ -162,8 +162,11 @@ static int load_xbc_file(const char *path, char **buf)
if (fd < 0)
return -errno;
ret = fstat(fd, &stat);
if (ret < 0)
return -errno;
if (ret < 0) {
ret = -errno;
close(fd);
return ret;
}
ret = load_xbc_fd(fd, buf, stat.st_size);