lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 18 May 2017 15:34:40 +0200
From:   Arnd Bergmann <arnd@...db.de>
To:     Miklos Szeredi <miklos@...redi.hu>
Cc:     Arnd Bergmann <arnd@...db.de>, Amir Goldstein <amir73il@...il.com>,
        linux-unionfs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] ovl: fix ovl_rename error handling

We try to clean up two objects before they got initialized:

fs/overlayfs/dir.c: In function 'ovl_rename':
fs/overlayfs/dir.c:1060:2: error: 'newdentry' may be used uninitialized in this function [-Werror=maybe-uninitialized]
fs/overlayfs/dir.c:891:17: note: 'newdentry' was declared here
fs/overlayfs/dir.c:1062:2: error: 'olddentry' may be used uninitialized in this function [-Werror=maybe-uninitialized]
fs/overlayfs/dir.c:890:17: note: 'olddentry' was declared here

Assuming that no special cleanup is required for the new code, the correct
branch target should be "out_revert_creds" to clean up everything that
got initialized up to then.

Fixes: 02cac3227a28 ("ovl: mark upper dir with type origin entries "impure"")
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
 fs/overlayfs/dir.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
index 5ad6ccf2159e..9b221cf50cb7 100644
--- a/fs/overlayfs/dir.c
+++ b/fs/overlayfs/dir.c
@@ -973,13 +973,13 @@ static int ovl_rename(struct inode *olddir, struct dentry *old,
 		if (ovl_type_origin(old) && !ovl_type_merge(new->d_parent)) {
 			err = ovl_set_impure(new->d_parent, new_upperdir);
 			if (err)
-				goto out_dput;
+				goto out_revert_creds;
 		}
 		if (!overwrite && ovl_type_origin(new) &&
 		    !ovl_type_merge(old->d_parent)) {
 			err = ovl_set_impure(old->d_parent, old_upperdir);
 			if (err)
-				goto out_dput;
+				goto out_revert_creds;
 		}
 	}
 
-- 
2.9.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ