Browse Source

ovl: Return -ENOMEM if an allocation fails ovl_lookup()

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>
Dan Carpenter 8 years ago
parent
commit
0ce5cdc9d7
1 changed files with 1 additions and 0 deletions
  1. 1 0
      fs/overlayfs/namei.c

+ 1 - 0
fs/overlayfs/namei.c

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