[PATCH v1 4/9] fs: fix possible null pointer dereference of base.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



we use base before checking if it is NULL

Signed-off-by: Oleksij Rempel <linux@xxxxxxxxxxxxxxxx>
---
 fs/fs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/fs.c b/fs/fs.c
index 42fd63ad0..625ed10b7 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);
-- 
2.17.1


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux