summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorOleksij Rempel <linux@rempel-privat.de>2018-11-20 21:07:09 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2018-11-21 09:08:09 +0100
commit21fa1c3ed23f572608cc089f266e588f6d5a7877 (patch)
tree63c577d967fdb1ee7eb12ccaf2a3122b8d676fdb /fs
parent342b8dd5a2341e3c0b0294dc885415163111f330 (diff)
downloadbarebox-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.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/fs.c b/fs/fs.c
index 42fd63ad08..625ed10b70 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -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);