From: Amir Goldstein Date: Tue, 11 Jul 2017 12:58:35 +0000 (+0300) Subject: ovl: fix random return value on mount X-Git-Tag: v4.9.40~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=97de6f34b42b079befb14e58e7f8b0d6e989c014;p=platform%2Fkernel%2Flinux-amlogic.git ovl: fix random return value on mount commit 8fc646b44385ff0a9853f6590497e43049eeb311 upstream. On failure to prepare_creds(), mount fails with a random return value, as err was last set to an integer cast of a valid lower mnt pointer or set to 0 if inodes index feature is enabled. Reported-by: Dan Carpenter Fixes: 3fe6e52f0626 ("ovl: override creds with the ones from ...") Signed-off-by: Amir Goldstein Signed-off-by: Miklos Szeredi Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index 2a01489..e7c8ac4 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -1310,6 +1310,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) else sb->s_d_op = &ovl_dentry_operations; + err = -ENOMEM; ufs->creator_cred = cred = prepare_creds(); if (!cred) goto out_put_lower_mnt;