linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ubi: fix correct rb_tree node comparison in add_vol
@ 2014-06-24  7:25 Heiko Schocher
  2014-06-25 21:11 ` Richard Weinberger
  2014-06-30 15:47 ` Artem Bityutskiy
  0 siblings, 2 replies; 3+ messages in thread
From: Heiko Schocher @ 2014-06-24  7:25 UTC (permalink / raw)
  To: linux-mtd
  Cc: Heiko Schocher, Artem Bityutskiy, Richard Weinberger,
	David Woodhouse, Brian Norris, Mike Snitzer, Wolfgang Denk,
	linux-kernel

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.

Signed-off-by: Heiko Schocher <hs@denx.de>

---

Cc: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Brian Norris <computersforpeace@gmail.com>
Cc: Mike Snitzer <snitzer@redhat.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: linux-mtd@lists.infradead.org
Cc: linux-kernel@vger.kernel.org

 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 b04e7d0..72f39da 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;
 		else
 			p = &(*p)->rb_right;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ubi: fix correct rb_tree node comparison in add_vol
  2014-06-24  7:25 [PATCH] ubi: fix correct rb_tree node comparison in add_vol Heiko Schocher
@ 2014-06-25 21:11 ` Richard Weinberger
  2014-06-30 15:47 ` Artem Bityutskiy
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Weinberger @ 2014-06-25 21:11 UTC (permalink / raw)
  To: Heiko Schocher, linux-mtd
  Cc: Artem Bityutskiy, David Woodhouse, Brian Norris, Mike Snitzer,
	Wolfgang Denk, linux-kernel

Am 24.06.2014 09:25, schrieb Heiko Schocher:
> 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.
> 
> Signed-off-by: Heiko Schocher <hs@denx.de>

Thanks a lot for fixing this!

Acked-by: Richard Weinberger <richard@nod.at>

Thanks,
//richard

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ubi: fix correct rb_tree node comparison in add_vol
  2014-06-24  7:25 [PATCH] ubi: fix correct rb_tree node comparison in add_vol Heiko Schocher
  2014-06-25 21:11 ` Richard Weinberger
@ 2014-06-30 15:47 ` Artem Bityutskiy
  1 sibling, 0 replies; 3+ messages in thread
From: Artem Bityutskiy @ 2014-06-30 15:47 UTC (permalink / raw)
  To: Heiko Schocher
  Cc: linux-mtd, Richard Weinberger, David Woodhouse, Brian Norris,
	Mike Snitzer, Wolfgang Denk, linux-kernel

On Tue, 2014-06-24 at 09:25 +0200, Heiko Schocher wrote:
> 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!

-- 
Best Regards,
Artem Bityutskiy


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-30 15:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-24  7:25 [PATCH] ubi: fix correct rb_tree node comparison in add_vol Heiko Schocher
2014-06-25 21:11 ` Richard Weinberger
2014-06-30 15:47 ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).