Patchwork UBI: fix bug in image sequence number handling

login
register
mail settings
Submitter Holger Brunck
Date July 13, 2009, 2:47 p.m.
Message ID <1247496477.3590.40.camel@pc005093.de.keymile.net>
Download mbox | patch
Permalink /patch/29736/
State New
Headers show

Comments

Holger Brunck - July 13, 2009, 2:47 p.m.
Hi all, 
I have seen a bug on the current 2.6.28 backport for UBI. But the same
bug seems to be present in the current ubi-2.6.git.

 
This patch fixes a bug in the image seq. number handling in the
scanning level. The assignment of the image_seq was incorrect.

Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
---
 drivers/mtd/ubi/scan.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

 			si->image_seq_set = 1;
Artem Bityutskiy - July 14, 2009, 5:43 a.m.
On Mon, 2009-07-13 at 16:47 +0200, Holger Brunck wrote:
> Hi all, 
> I have seen a bug on the current 2.6.28 backport for UBI. But the same
> bug seems to be present in the current ubi-2.6.git.
> 
>  
> This patch fixes a bug in the image seq. number handling in the
> scanning level. The assignment of the image_seq was incorrect.
> 
> Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
> ---
>  drivers/mtd/ubi/scan.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c
> index 065c4ba..e337b0b 100644
> --- a/drivers/mtd/ubi/scan.c
> +++ b/drivers/mtd/ubi/scan.c
> @@ -781,7 +781,7 @@ static int process_eb(struct ubi_device *ubi, struct
> ubi_scan_info *si,
>  			return -EINVAL;
>  		}
>  
> -		image_seq = be32_to_cpu(ech->ec);
> +		image_seq = be32_to_cpu(ech->image_seq);
>  		if (!si->image_seq_set) {
>  			ubi->image_seq = image_seq;
>  			si->image_seq_set = 1;

Yes, this is me who did this in the
"UBI: nicify image sequence number handling" commit. Sorry, really
shame bug. Where is my brown paper-bag? I've pushed your patch to
all trees.

BTW, the patch was line-wrapped.

Patch

diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c
index 065c4ba..e337b0b 100644
--- a/drivers/mtd/ubi/scan.c
+++ b/drivers/mtd/ubi/scan.c
@@ -781,7 +781,7 @@  static int process_eb(struct ubi_device *ubi, struct
ubi_scan_info *si,
 			return -EINVAL;
 		}
 
-		image_seq = be32_to_cpu(ech->ec);
+		image_seq = be32_to_cpu(ech->image_seq);
 		if (!si->image_seq_set) {
 			ubi->image_seq = image_seq;