10 Commits

Author SHA1 Message Date
Tom Rini
94e690c44a 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
2025-08-21 15:05:15 -06:00
Martin Schwan
498e423457 bootstd: rauc: Free private data when booting
The private data struct can be freed when loading the boot script, as we
don't need the slot information anymore at this point.

Signed-off-by: Martin Schwan <m.schwan@phytec.de>
Tested-by: Wadim Egorov <w.egorov@phytec.de>
2025-08-21 15:05:04 -06:00
Martin Schwan
302830499d bootstd: rauc: Move freeing private struct to its own function
Move freeing a distro_rauc_priv struct to a new, separate function for
better reuse.

Signed-off-by: Martin Schwan <m.schwan@phytec.de>
Tested-by: Wadim Egorov <w.egorov@phytec.de>
2025-08-21 15:05:04 -06:00
Martin Schwan
b389967f9a bootstd: rauc: Don't null bootflow->bootmeth_priv
Don't null bootflow->bootmeth_priv, as the private struct is freed later
on by the bootflow.

Signed-off-by: Martin Schwan <m.schwan@phytec.de>
Tested-by: Wadim Egorov <w.egorov@phytec.de>
2025-08-21 15:05:04 -06:00
Martin Schwan
074066790c bootstd: rauc: Fix segfault when cleaning up slots
Fix a segfault when cleaning up the slots from the private struct. This
fault was generated by accessing a member of a null pointer.

Signed-off-by: Martin Schwan <m.schwan@phytec.de>
Tested-by: Wadim Egorov <w.egorov@phytec.de>
2025-08-21 15:05:04 -06:00
Martin Schwan
0c558bbad9 bootstd: rauc: Change global method to check any partition
The bootmeth rauc should scan all partitions, in particular whole
devices, and not be a global method. There may exist multiple RAUC
systems on different devices and they should all be detected. This also
fixes a bug, where both a global bootflow and one using an actual,
complete device would be detected at the same time, when scanning for
valid bootflows.

Signed-off-by: Martin Schwan <m.schwan@phytec.de>
Tested-by: Wadim Egorov <w.egorov@phytec.de>
2025-08-14 09:18:43 -06:00
Martin Schwan
f271b06270 bootstd: rauc: Only scan all partitions instead of boot files
Only scan for the existence of all required partitions of a RAUC system,
instead of searching for boot script files in all of them.

Previously, it might have occurred, that a slot did not contain required
files and RAUC already marked the corresponding slot as bad (not
suitable for booting). In that case, scanning for a non-existence boot
script would result in an error (and thus not booting anything), which
was different behavior compared to the legacy RAUC boot.

Signed-off-by: Martin Schwan <m.schwan@phytec.de>
2025-07-22 13:53:17 -06:00
Martin Schwan
84cef694e7 bootstd: rauc: Fix segfault occurring during private struct access
Fix a potential segmentation fault, by not accessing the member of a
null pointer to a private slot's name field.

Signed-off-by: Martin Schwan <m.schwan@phytec.de>
2025-07-22 13:53:17 -06:00
Martin Schwan
a7d1214d2c bootstd: rauc: Fix potential memory leak
Fix a potential memory leak, by checking the return value of realloc
first, before assigning it to the private list of slots.

Signed-off-by: Martin Schwan <m.schwan@phytec.de>
2025-07-22 13:53:17 -06:00
Martin Schwan
7e5c2c782f bootstd: Add implementation for bootmeth rauc
Add a bootmeth driver which supports booting A/B system with RAUC as
their update client.

Signed-off-by: Martin Schwan <m.schwan@phytec.de>
Tested-by: Wadim Egorov <w.egorov@phytec.de>
2025-06-18 12:15:35 -06:00