[PATCH 1/6] fastboot: terminate request for non-file-backed partition properly

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Apr 28 05:52:13 PDT 2025


If addition of fastboot variables fail due to a specific partition, it's
not enough to log a warning at the barebox side, but we need to return
an error to the client too, otherwise it will hang indefinitely.

Fixes: 6a191155be4e ("fastboot: evaluate fastboot partitions when used")
Reported-by: Uwe Kleine-König <uwe at kleine-koenig.org>
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 common/fastboot.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/common/fastboot.c b/common/fastboot.c
index 34ac00bb0ecf..5a43bfb7e596 100644
--- a/common/fastboot.c
+++ b/common/fastboot.c
@@ -298,8 +298,12 @@ static void cb_getvar(struct fastboot *fb, const char *cmd)
 
 		ret = fastboot_add_partition_variables(fb, &partition_list, fentry);
 		if (ret) {
-			pr_warn("Failed to add partition variables: %pe", ERR_PTR(ret));
-			return;
+			char *msg = xasprintf("%s: Failed to add '%s' partition variables: %pe",
+					      fentry->name, fentry->filename, ERR_PTR(ret));
+			pr_warn("%s\n", msg);
+			fastboot_tx_print(fb, FASTBOOT_MSG_FAIL, "%s", msg);
+			free(msg);
+			goto out;
 		}
 	}
 
-- 
2.39.5




More information about the barebox mailing list