From mboxrd@z Thu Jan 1 00:00:00 1970 From: Amir Goldstein Subject: [PATCH 02/10] ovl: fix random return value on mount Date: Tue, 11 Jul 2017 15:58:35 +0300 Message-ID: <1499777923-29410-3-git-send-email-amir73il@gmail.com> References: <1499777923-29410-1-git-send-email-amir73il@gmail.com> Return-path: In-Reply-To: <1499777923-29410-1-git-send-email-amir73il@gmail.com> Sender: stable-owner@vger.kernel.org To: Miklos Szeredi Cc: linux-unionfs@vger.kernel.org, "# v4 . 7" List-Id: linux-unionfs@vger.kernel.org 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 ...") Cc: # v4.7 Signed-off-by: Amir Goldstein --- fs/overlayfs/super.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index 44dc2d6ffe0f..1cf5d3538309 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -1090,6 +1090,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_indexdir; -- 2.7.4