[U-Boot] [PATCH v2 1/1] ubifs: avoid possible NULL dereference
Ladislav Michl
ladis at linux-mips.org
Wed Nov 22 15:47:04 UTC 2017
On Wed, Nov 22, 2017 at 02:37:49PM +0100, Ladislav Michl wrote:
> On Wed, Nov 22, 2017 at 01:37:54PM +0100, Heinrich Schuchardt wrote:
[snip]
> > I agree that there is a memory leak. But we should put fixing that into a
> > separate patch so that we can test both modifications separately.
>
> There was no such memory leak before above patch.
>
> > It is not enough to kfree(dent).
> > ubifs_tnc_next_ent may return ERR_PTR(err) and we do not want to pass this
> > value to kfree.
>
> Nobody is claiming otherwise.
>
> > As Wolfgang wrote we should pass error codes to the calling chain of
> > ubifs_finddir(), i.e. ubifs_findfile(), ubifs_size(), ubifs_read,
> > ubifs_exists(), ubifs_ls(), ...
> >
> > The code also lacks support for the driver model.
> >
> > So a lot of other patches needed.
>
> Yes, but fix should not add another bug.
>
> > If you think this patch fixes what it promises to fix, please, add your
> > review comment.
>
> What about (untested)?
[snip]
Okay, just tried to test it. Does ubifsmount even work for you?
I cannot mount volume neither using name nor id.
Does not work on NAND:
=> ubi part UBI
=> ubifsmount ubi0:rootfs
UBIFS assert failed in ubifs_change_lp at 540
UBIFS assert failed in ubifs_release_lprops at 278
UBIFS assert failed in ubifs_change_lp at 540
UBIFS assert failed in ubifs_release_lprops at 278
UBIFS assert failed in ubifs_change_lp at 540
UBIFS assert failed in ubifs_release_lprops at 278
UBIFS assert failed in ubifs_change_lp at 540
UBIFS assert failed in ubifs_release_lprops at 278
=> ubifsmount ubi5
UBIFS assert failed in ubifs_change_lp at 540
UBIFS assert failed in ubifs_release_lprops at 278
UBIFS assert failed in ubifs_change_lp at 540
UBIFS assert failed in ubifs_release_lprops at 278
UBIFS assert failed in ubifs_change_lp at 540
UBIFS assert failed in ubifs_release_lprops at 278
UBIFS assert failed in ubifs_change_lp at 540
UBIFS assert failed in ubifs_release_lprops at 278
=> ubifsmount ubi0_5
UBIFS error (pid: 1): cannot open "ubi0_5", error -19Error reading superblock on volume 'ubi0_5' errno=-19!
ubifsmount - mount UBIFS volume
Usage:
ubifsmount <volume-name>
- mount 'volume-name' volume
=> ubifsmount ubi0_5
<hangs here>
Does not work on OneNAND:
=> ubifsmount ubi0_5
Error reading superblock on volume 'ubi0_5' errno=-22!
ubifsmount - mount UBIFS volume
Usage:
ubifsmount <volume-name>
- mount 'volume-name' volume
=> ubifsmount ubi0_5
UBIFS error (ubi0:5 pid 0): check_lpt_crc: invalid crc in LPT node: crc d514 calc 6695
UBIFS error (ubi0:5 pid 0): read_pnode: error -22 reading pnode at 8:16424
(pid 1) dumping pnode:
address 9dfb2dc0 parent 9dfb2d40 cnext 0
flags 0 iip 1 level 0 num 0
0: free 0 dirty 97240 flags 1 lnum 0
1: free 57344 dirty 39752 flags 34 lnum 0
2: free 0 dirty 111296 flags 1 lnum 0
3: free 0 dirty 85952 flags 34 lnum 0
UBIFS error (ubi0:5 pid 0): read_pnode: calc num: 89
UBIFS assert failed in ubifs_release_lprops at 278
Error reading superblock on volume 'ubi0_5' errno=-22!
ubifsmount - mount UBIFS volume
Usage:
ubifsmount <volume-name>
- mount 'volume-name' volume
See? It even gives different output for the same command.
Tried every possible options to mount volume found in open_ubi...
So given above unfortunate state, I'm considering fixing $subject mentioned
a bit pointless as I'm not able to test it.
I'll look at mount problems later.
ladis
More information about the U-Boot
mailing list