[PATCH 07/10] UBI: fix the volumes tree sorting criteria

Sascha Hauer s.hauer at pengutronix.de
Thu Sep 11 08:16:07 PDT 2014

From: Heiko Schocher <hs at denx.de>

Commig "604b592 UBI: fix rb_tree node comparison in add_map"
broke fastmap backward compatibility and older fastmap images
cannot be mounted anymore. The reason is that it changes the
volumes RB-tree sorting criteria. This patch fixes the problem.

Artem: re-write the commit message

Signed-off-by: Heiko Schocher <hs at denx.de>
Acked-by: Richard Weinberger <richard at nod.at>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
 drivers/mtd/ubi/fastmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
index 3aa7aa8..21b7f07 100644
--- a/drivers/mtd/ubi/fastmap.c
+++ b/drivers/mtd/ubi/fastmap.c
@@ -125,7 +125,7 @@ static struct ubi_ainf_volume *add_vol(struct ubi_attach_info *ai, int vol_id,
 		parent = *p;
 		av = rb_entry(parent, struct ubi_ainf_volume, rb);
-		if (vol_id < av->vol_id)
+		if (vol_id > av->vol_id)
 			p = &(*p)->rb_left;
 			p = &(*p)->rb_right;

More information about the barebox mailing list