diff options
author | Gaël PORTAY <gael.portay@savoirfairelinux.com> | 2018-03-18 18:22:36 -0400 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-03-19 09:36:40 +0100 |
commit | ca880912a473ec6e92d78ddf0aa24857536e57da (patch) | |
tree | 8817751743ed57e4a5817296e80641272c31ae11 | |
parent | f9c96e2e52b0b5a8594720a45116c12500796e9a (diff) | |
download | barebox-ca880912a473ec6e92d78ddf0aa24857536e57da.tar.gz barebox-ca880912a473ec6e92d78ddf0aa24857536e57da.tar.xz |
fs: check pointer returned by get_fsdevice_by_path before dereferencing
In __canonicalize_path() we dereference the pointer returned by
get_fsdevice_by_path() without checking if the pointer is NULL or not.
When the pointer is NULL it leads to an Ooops.
Ooops, address error on load or ifetch!
$ 0 : 00000000 00000001 a0000026 a0811c10
$ 4 : a0402e60 a0402e48 a0811c00 a0402e58
$ 8 : 00000001 00000000 0000005a 00000023
$12 : 00000000 00000002 00601021 00000000
$16 : a0402e60 a0402e50 a0402e39 a0810000
$20 : a0402e38 a0811420 a0811424 00000000
$24 : 00000000 a080de10
$28 : 87f87d40 a03ffa68 a0810000 a080ce30
Hi : 00000002
Lo : 00000000
epc : a080ce34
ra : a080ce30
Status: 00000006
Cause : 40008010
Config: 80040483
### ERROR ### Please RESET the board ###
Fixes: d79a81736 fs: Don't bother filesystems without link support with additional stat() calls
Signed-off-by: Gaël PORTAY <gael.portay@savoirfairelinux.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | fs/fs.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -191,7 +191,7 @@ static char *__canonicalize_path(const char *_pathname, int level) * with an additional stat() call. */ fsdev = get_fsdevice_by_path(outpath); - if (!fsdev->driver->readlink) + if (!fsdev || !fsdev->driver->readlink) continue; ret = __lstat(outpath, &s); |