Merge patch series "bootstd: rauc: Fix segfault when scanning device with unsupported layout"

Martin Schwan <m.schwan@phytec.de> says:

This series fixes a segfault, that would occur at the end of scanning a
device, which does not contain the required partition layout scheme for
a RAUC system.

With this series, a "bootflow scan" should now correctly scan the
specified devices with boot method "rauc" without crashing on invalid
partition schemes.

Link: https://lore.kernel.org/r/20250813-wip-bootmeth-rauc-priv-free-v1-0-1ef928169469@phytec.de
This commit is contained in:
Tom Rini
2025-08-21 15:05:15 -06:00
+15 -6
View File
@@ -52,6 +52,18 @@ struct distro_rauc_priv {
struct distro_rauc_slot **slots;
};
static void distro_rauc_priv_free(struct distro_rauc_priv *priv)
{
int i;
for (i = 0; priv->slots[i]; i++) {
free(priv->slots[i]->name);
free(priv->slots[i]);
}
free(priv->slots);
free(priv);
}
static struct distro_rauc_slot *get_slot(struct distro_rauc_priv *priv,
const char *slot_name)
{
@@ -187,13 +199,8 @@ static int distro_rauc_read_bootflow(struct udevice *dev, struct bootflow *bflow
ret = distro_rauc_scan_parts(bflow);
if (ret < 0) {
for (i = 0; priv->slots[i]->name; i++) {
free(priv->slots[i]->name);
free(priv->slots[i]);
}
free(priv);
distro_rauc_priv_free(priv);
free(boot_order_copy);
bflow->bootmeth_priv = NULL;
return ret;
}
@@ -402,6 +409,8 @@ static int distro_rauc_boot(struct udevice *dev, struct bootflow *bflow)
if (ret)
return log_msg_ret("boot", ret);
distro_rauc_priv_free(priv);
return 0;
}