Bootconfig fixes for v7.1-rc4

- tools/bootconfig: Fix buf leaks in apply_xbc
   If data memory allocation failed, free the buf before return.
 -----BEGIN PGP SIGNATURE-----
 
 iQFPBAABCgA5FiEEh7BulGwFlgAOi5DV2/sHvwUrPxsFAmoTCt0bHG1hc2FtaS5o
 aXJhbWF0c3VAZ21haWwuY29tAAoJENv7B78FKz8b8NEH/RBpnMMjF488qq3Uv8a7
 0VpUd2YGvzKjybO0t/reOYtVGNbnbUlAqIF/nAZpynGJ9e8/u/+FUOq4D7GTBD9J
 18wwhf9mtNTyo+awzclpf6O7aUu+xM0+J4O1uWHKsY6nEyp//koLGOW+jQ1ju5JK
 b7jHuvLeWvEhJ0pg0CahdCqdpAPSe064zue2szHop0gywnuaYX7MjNLVdk5MHfdq
 XbiKb2M15ZllD4hYBCHKBsJevtxcjdBx5Jwj3YKzt4K9gedNnIUE8Lliar7inGE4
 syCQtc1V8Un/v5XVk+24rPGtRnDGrBASWcfgKURIv/bFXqqFI2wzl0+Po9c7R12L
 u6U=
 =NBvF
 -----END PGP SIGNATURE-----

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

Pull bootconfig fix from Masami Hiramatsu:

 - Fix buf leak in apply_xbc

* tag 'bootconfig-fixes-v7.1-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
  tools/bootconfig: Fix buf leaks in apply_xbc
This commit is contained in:
Linus Torvalds 2026-05-25 12:22:50 -07:00
commit c112662a0e

View File

@ -390,8 +390,10 @@ static int apply_xbc(const char *path, const char *xbc_path)
/* Backup the bootconfig data */
data = calloc(size + BOOTCONFIG_ALIGN + BOOTCONFIG_FOOTER_SIZE, 1);
if (!data)
if (!data) {
free(buf);
return -ENOMEM;
}
memcpy(data, buf, size);
/* Check the data format */