ovl: check ERR_PTR() return value from ovl_lookup_real()
authorAmir Goldstein <amir73il@gmail.com>
Tue, 30 Jan 2018 12:30:50 +0000 (14:30 +0200)
committerMiklos Szeredi <mszeredi@redhat.com>
Fri, 16 Feb 2018 14:53:20 +0000 (15:53 +0100)
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 061701540349 ("ovl: lookup indexed ancestor of lower dir")
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/overlayfs/export.c

index 9df455c..97a916e 100644 (file)
@@ -477,8 +477,8 @@ static struct dentry *ovl_lookup_real_inode(struct super_block *sb,
                dput(upper);
        }
 
-       if (!this)
-               return NULL;
+       if (IS_ERR_OR_NULL(this))
+               return this;
 
        if (WARN_ON(ovl_dentry_real_at(this, layer->idx) != real)) {
                dput(this);