Skip to content
Snippets Groups Projects
Commit 349a8d5e authored by Lars Poeschel's avatar Lars Poeschel Committed by Stefan Roese
Browse files

ubifs bad superblock bug


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.

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'!

Signed-off-by: default avatarLars Poeschel <larsi@wh2.tu-dresden.de>
Cc: Kyungmin Park <kmpark@infradead.org>
Signed-off-by: default avatarStefan Roese <sr@denx.de>
parent 0841ca90
No related branches found
No related tags found
No related merge requests found
...@@ -848,9 +848,11 @@ void ubifs_umount(struct ubifs_info *c) ...@@ -848,9 +848,11 @@ void ubifs_umount(struct ubifs_info *c)
ubifs_debugging_exit(c); ubifs_debugging_exit(c);
/* Finally free U-Boot's global copy of superblock */ /* Finally free U-Boot's global copy of superblock */
if (ubifs_sb != NULL) {
free(ubifs_sb->s_fs_info); free(ubifs_sb->s_fs_info);
free(ubifs_sb); free(ubifs_sb);
} }
}
/** /**
* open_ubi - parse UBI device name string and open the UBI device. * open_ubi - parse UBI device name string and open the UBI device.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment