public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2] ubifs bad superblock bug
@ 2011-10-04 11:35 larsi
  2011-10-12  9:39 ` Stefan Roese
  0 siblings, 1 reply; 2+ messages in thread
From: larsi @ 2011-10-04 11:35 UTC (permalink / raw)
  To: u-boot

 This patch fixes an issue when ubifs reads a bad superblock. Later it
 tries to free memory, that was not allocated, which freezes u-boot.
 This is fixed by looking for a non null pointer before free.

 Signed-off-by: Lars Poeschel <larsi@wh2.tu-dresden.de>
 Cc: Kyungmin Park <kmpark@infradead.org>
 ---
 The message I got before u-boot freezes:
 UBI: max/mean erase counter: 53/32
 UBIFS: mounted UBI device 0, volume 1, name "rootfs"
 UBIFS: mounted read-only
 UBIFS: file system size:   49140 bytes (50319360 KiB, 0 MiB, 49140 
 LEBs)
 UBIFS: journal size:       49 bytes (6838272 KiB, 0 MiB, 6678 LEBs)
 UBIFS: media format:       w4/r0 (latest is w4/r0)
 UBIFS: default compressor: LZO
 UBIFS: reserved for root:  0 bytes (0 KiB)
 UBIFS error (pid 0): ubifs_read_node: bad node type (255 but expected 
 9)
 UBIFS error (pid 0): ubifs_read_node: bad node at LEB 330:13104
 UBIFS error (pid 0): ubifs_iget: failed to read inode 1, error -22
 Error reading superblock on volume 'ubi:rootfs'!

 Changes for v2:
   - null has to be NULL

  fs/ubifs/super.c |    6 ++++--
  1 files changed, 4 insertions(+), 2 deletions(-)

 diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
 index 63b2164..20fb244 100644
 --- a/fs/ubifs/super.c
 +++ b/fs/ubifs/super.c
 @@ -848,8 +848,10 @@ void ubifs_umount(struct ubifs_info *c)
  	ubifs_debugging_exit(c);
 
  	/* Finally free U-Boot's global copy of superblock */
 -	free(ubifs_sb->s_fs_info);
 -	free(ubifs_sb);
 +	if (ubifs_sb != NULL) {
 +		free(ubifs_sb->s_fs_info);
 +		free(ubifs_sb);
 +	}
  }
 
  /**
-- 
 1.7.4.1

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

* [U-Boot] [PATCH v2] ubifs bad superblock bug
  2011-10-04 11:35 [U-Boot] [PATCH v2] ubifs bad superblock bug larsi
@ 2011-10-12  9:39 ` Stefan Roese
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Roese @ 2011-10-12  9:39 UTC (permalink / raw)
  To: u-boot

Hi Lars,

On Tuesday 04 October 2011 13:35:07 larsi wrote:
>  This patch fixes an issue when ubifs reads a bad superblock. Later it
>  tries to free memory, that was not allocated, which freezes u-boot.
>  This is fixed by looking for a non null pointer before free.

I had to manually apply this patch because it didn't apply clean.

Applied to u-boot-ubi/master. Thanks.
 
Best regards,
Stefan

--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de

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

end of thread, other threads:[~2011-10-12  9:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-04 11:35 [U-Boot] [PATCH v2] ubifs bad superblock bug larsi
2011-10-12  9:39 ` Stefan Roese

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox