From patchwork Tue Jun 24 07:25:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Schocher X-Patchwork-Id: 363326 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id B203C140081 for ; Tue, 24 Jun 2014 17:27:48 +1000 (EST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WzL70-0002f3-Hg; Tue, 24 Jun 2014 07:25:50 +0000 Received: from mail-out.m-online.net ([2001:a60:0:28:0:1:25:1]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WzL6x-0002cb-9S for linux-mtd@lists.infradead.org; Tue, 24 Jun 2014 07:25:48 +0000 Received: from frontend3.mail.m-online.net (frontend2.mail.intern.m-online.net [192.168.8.181]) by mail-out.m-online.net (Postfix) with ESMTP id 3gyJt86fP0z3hhmp; Tue, 24 Jun 2014 09:25:20 +0200 (CEST) X-Auth-Info: uljASq7ZkCqtqY+H2xS7hzHpIwLIB5zpGWyrhmutZdk= Received: from mail.denx.de (host-82-135-33-74.customer.m-online.net [82.135.33.74]) by smtp-auth.mnet-online.de (Postfix) with ESMTPA id 3gyJt84bnXzbbcM; Tue, 24 Jun 2014 09:25:20 +0200 (CEST) Received: from pollux.denx.de (pollux [192.168.1.1]) by mail.denx.de (Postfix) with ESMTP id 3BD4034336D; Tue, 24 Jun 2014 09:25:20 +0200 (CEST) Received: by pollux.denx.de (Postfix, from userid 515) id C11AFD66F; Tue, 24 Jun 2014 09:25:19 +0200 (CEST) From: Heiko Schocher To: linux-mtd@lists.infradead.org Subject: [PATCH] ubi: fix correct rb_tree node comparison in add_vol Date: Tue, 24 Jun 2014 09:25:18 +0200 Message-Id: <1403594718-20595-1-git-send-email-hs@denx.de> X-Mailer: git-send-email 1.8.3.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140624_002547_514351_9D1E9BB5 X-CRM114-Status: UNSURE ( 9.85 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- Cc: Heiko Schocher , Mike Snitzer , Artem Bityutskiy , linux-kernel@vger.kernel.org, Richard Weinberger , Brian Norris , David Woodhouse X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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 Acked-by: Richard Weinberger --- Cc: Artem Bityutskiy Cc: Richard Weinberger Cc: David Woodhouse Cc: Brian Norris Cc: Mike Snitzer Cc: Wolfgang Denk 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;