diff options
author | Oleksij Rempel <linux@rempel-privat.de> | 2018-11-20 21:07:09 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-11-21 09:08:09 +0100 |
commit | 21fa1c3ed23f572608cc089f266e588f6d5a7877 (patch) | |
tree | 63c577d967fdb1ee7eb12ccaf2a3122b8d676fdb /fs | |
parent | 342b8dd5a2341e3c0b0294dc885415163111f330 (diff) | |
download | barebox-21fa1c3ed23f572608cc089f266e588f6d5a7877.tar.gz barebox-21fa1c3ed23f572608cc089f266e588f6d5a7877.tar.xz |
fs: fix possible null pointer dereference of base.
we use base before checking if it is NULL
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/fs.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -1526,7 +1526,7 @@ static struct dentry *__lookup_hash(const struct qstr *name, { struct dentry *dentry; struct dentry *old; - struct inode *dir = base->d_inode; + struct inode *dir; if (!base) return ERR_PTR(-ENOENT); @@ -1539,6 +1539,7 @@ static struct dentry *__lookup_hash(const struct qstr *name, if (unlikely(!dentry)) return ERR_PTR(-ENOMEM); + dir = base->d_inode; old = dir->i_op->lookup(dir, dentry, flags); if (IS_ERR(old)) { dput(dentry); |