Skip to contentSkip to conversation

ubi: fix correct rb_tree node comparison in add_vol

PATCH In review Heiko Schocher 3 participants 3 messages Jun 24, 2014 – Jun 30, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ubi: fix correct rb_tree node comparison in add_vol

Commit 604b592e6fd3c98f21435e1181ba7723ffc24715 ("UBI: fix rb_tree node comparison in add_map")

introduced problems with attaching ubi fastmap images, created with older kernel.

As in ubi_find_av() from attach.c is
[...]

                if (vol_id > av->vol_id)
                        p = p->rb_left;
                else
                        p = p->rb_right;

sync this logic also in add_vol() with this.

With this patch attaching older ubi images works again.

---

Cc Artem Bityutskiy <[email protected]>
Cc Richard Weinberger <[email protected]>
Cc David Woodhouse <[email protected]>
Cc Brian Norris <[email protected]>
Cc Mike Snitzer <[email protected]>
Cc Wolfgang Denk <[email protected]>
 drivers/mtd/ubi/fastmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/ubi/fastmap.c +1 -1
index b04e7d0..72f39da 100644
@@ -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;
 		else
 			p = &(*p)->rb_right;
Signature · 1 line
1.8.3.1
maintainer Acked-by on v1 1/1
#1 lore raw

Am 24.06.2014 09:25, schrieb Heiko Schocher:

Quoted 12 lines

Commit 604b592e6fd3c98f21435e1181ba7723ffc24715 ("UBI: fix rb_tree node comparison in add_map")

introduced problems with attaching ubi fastmap images, created with older kernel.

As in ubi_find_av() from attach.c is
[...]

                if (vol_id > av->vol_id)
                        p = p->rb_left;
                else
                        p = p->rb_right;
Quoted 5 lines

sync this logic also in add_vol() with this.

With this patch attaching older ubi images works again.

Thanks a lot for fixing this!

Thanks,
//richard

#2 lore raw
In reply to Heiko Schocher
Quoted 4 lines · Heiko Schocher

Commit 604b592e6fd3c98f21435e1181ba7723ffc24715 ("UBI: fix rb_tree node comparison in add_map")

introduced problems with attaching ubi fastmap images, created with older kernel.

Changed the commit message to be a bit more reader-friendly and pushed to linux-ubifs.git, thank you!

Signature · 2 lines
Best Regards,
Artem Bityutskiy