[PATCH 1/1] handlers: ubivol: fix missing device strlen check

25 views
Skip to first unread message

sam.van....@gmail.com

unread,
Jun 20, 2024, 4:49:40 AM (14 days ago) Jun 20
to swup...@googlegroups.com, Sam Van Den Berge
From: Sam Van Den Berge <sam.van....@gmail.com>

Commit "5604c225 handlers: ubivol: Allow specifying MTD device" breaks UBI A/B
volume updates with an atomic swap at the end of the update because 1 strlen
check is missing in ubi_volume_get_info.

This fixes the following error:

[ERROR] : SWUPDATE failed [0] ERROR : does not exist
[ERROR] : SWUPDATE failed [0] ERROR : could not found UBI volume root_r
[ERROR] : SWUPDATE failed [0] ERROR : execute postinstall scripts failed
[ERROR] : SWUPDATE failed [1] Installation failed !

Signed-off-by: Sam Van Den Berge <sam.van....@gmail.com>
---
handlers/ubivol_handler.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/handlers/ubivol_handler.c b/handlers/ubivol_handler.c
index 9db6472e..0ad0321e 100644
--- a/handlers/ubivol_handler.c
+++ b/handlers/ubivol_handler.c
@@ -506,7 +506,7 @@ static int ubi_volume_get_info(char *device, char *name, int *dev_num, int *vol_
{
struct ubi_part *ubi_part;

- if (device)
+ if (strlen(device))
ubi_part = search_volume_local(device, name);
else
ubi_part = search_volume_global(name);
--
2.43.0

sam.van....@gmail.com

unread,
Jun 20, 2024, 4:49:40 AM (14 days ago) Jun 20
to swup...@googlegroups.com, Sam Van Den Berge
From: Sam Van Den Berge <sam.van....@gmail.com>

Commit "5604c225 handlers: ubivol: Allow specifying MTD device" breaks UBI A/B
volume updates with an atomic swap at the end of the update because 1 strlen
check is missing in ubi_volume_get_info.

I think this bug is pretty serious because since release 2024.05, the ubiswap
fails after an update and hence the update fails.

Would it be possible to create a new (patch) release with this fix included?

Sam Van Den Berge (1):
handlers: ubivol: fix missing device strlen check

handlers/ubivol_handler.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--
2.43.0

Dominique MARTINET

unread,
Jun 20, 2024, 5:09:02 AM (14 days ago) Jun 20
to sam.van....@gmail.com, swup...@googlegroups.com
device comes from img->device which is part of img so cannot be NULL,
looks good to me.

(style wise I'd nitpick all these 'if (strlen(device))' checks in this
file could be 'if (device[0])' as we don't care about the length, but it
doesn't really matter for this kind of sizes)

Reviewed-by: Dominique Martinet <dominique...@atmark-techno.com>

Thanks!
--
Dominique

Stefano Babic

unread,
Jun 20, 2024, 5:24:21 AM (14 days ago) Jun 20
to sam.van....@gmail.com, swup...@googlegroups.com
On 20.06.24 10:49, sam.van....@gmail.com wrote:
> From: Sam Van Den Berge <sam.van....@gmail.com>
>
> Commit "5604c225 handlers: ubivol: Allow specifying MTD device" breaks UBI A/B
> volume updates with an atomic swap at the end of the update because 1 strlen
> check is missing in ubi_volume_get_info.
>
> I think this bug is pretty serious because since release 2024.05, the ubiswap
> fails after an update and hence the update fails.
>
> Would it be possible to create a new (patch) release with this fix included?

I will take care of it and release a 2024.05.1

Regards,
Stefano
Reply all
Reply to author
Forward
0 new messages