Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1644543 > unrolled thread

[PATCH] ovl: fix ovl_rename error handling

Started byArnd Bergmann <arnd@arndb.de>
First post2017-05-18 15:40 +0200
Last post2017-05-18 16:20 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] ovl: fix ovl_rename error handling Arnd Bergmann <arnd@arndb.de> - 2017-05-18 15:40 +0200
    Re: [PATCH] ovl: fix ovl_rename error handling Amir Goldstein <amir73il@gmail.com> - 2017-05-18 16:00 +0200
      Re: [PATCH] ovl: fix ovl_rename error handling Miklos Szeredi <miklos@szeredi.hu> - 2017-05-18 16:20 +0200

#1644543 — [PATCH] ovl: fix ovl_rename error handling

FromArnd Bergmann <arnd@arndb.de>
Date2017-05-18 15:40 +0200
Subject[PATCH] ovl: fix ovl_rename error handling
Message-ID<tItOO-3bL-31@gated-at.bofh.it>
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@arndb.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

[toc] | [next] | [standalone]


#1644575

FromAmir Goldstein <amir73il@gmail.com>
Date2017-05-18 16:00 +0200
Message-ID<tIu8a-3sl-17@gated-at.bofh.it>
In reply to#1644543
On Thu, May 18, 2017 at 4:34 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> 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.
>

Yep, this is correct. You are the 4th to send this patch :)
Thanks

[toc] | [prev] | [next] | [standalone]


#1644590

FromMiklos Szeredi <miklos@szeredi.hu>
Date2017-05-18 16:20 +0200
Message-ID<tIurw-3RH-15@gated-at.bofh.it>
In reply to#1644575
On Thu, May 18, 2017 at 3:57 PM, Amir Goldstein <amir73il@gmail.com> wrote:
> On Thu, May 18, 2017 at 4:34 PM, Arnd Bergmann <arnd@arndb.de> wrote:
>> 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.
>>
>
> Yep, this is correct. You are the 4th to send this patch :)
> Thanks

Pushed to overlayfs-next together with other fixes.  Sorry for the delay.

Thanks,
Miklos

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web