ovl: Return -ENOMEM if an allocation fails ovl_lookup()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 22 Sep 2017 20:45:18 +0000 (23:45 +0300)
committerMiklos Szeredi <mszeredi@redhat.com>
Thu, 19 Oct 2017 14:19:52 +0000 (16:19 +0200)
The error code is missing here so it means we return ERR_PTR(0) or NULL.
The other error paths all return an error code so this probably should
as well.

Fixes: 02b69b284cd7 ("ovl: lookup redirects")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/overlayfs/namei.c

index 654bea1..e081641 100644 (file)
@@ -635,6 +635,7 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
                }
 
                if (d.redirect) {
+                       err = -ENOMEM;
                        upperredirect = kstrdup(d.redirect, GFP_KERNEL);
                        if (!upperredirect)
                                goto out_put_upper;