All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 4.4] ext4: correct error label in ext4_rename()
  2021-04-23 12:35 [PATCH 4.4] ext4: correct error label in ext4_rename() Zhang Yi
@ 2021-04-23 12:34 ` Greg KH
  2021-04-23 12:56   ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2021-04-23 12:34 UTC (permalink / raw)
  To: Zhang Yi; +Cc: stable, tytso, sashal

On Fri, Apr 23, 2021 at 08:35:07PM +0800, Zhang Yi wrote:
> The backport of upstream patch 5dccdc5a1916 ("ext4: do not iput inode
> under running transaction in ext4_rename()") introduced a regression on
> the stable kernels 4.14 and older. One of the end_rename error label was
> forgetting to change to release_bh, which may trigger below bug.
> 
>  ------------[ cut here ]------------
>  kernel BUG at /home/zhangyi/hulk-4.4/fs/ext4/ext4_jbd2.c:30!
>  ...
>  Call Trace:
>   [<ffffffff8b4207b2>] ext4_rename+0x9e2/0x10c0
>   [<ffffffff8b331324>] ? unlazy_walk+0x124/0x2a0
>   [<ffffffff8b420eb5>] ext4_rename2+0x25/0x60
>   [<ffffffff8b335104>] vfs_rename+0x3a4/0xed0
>   [<ffffffff8b33a7ad>] SYSC_renameat2+0x57d/0x7f0
>   [<ffffffff8b33c119>] SyS_renameat+0x19/0x30
>   [<ffffffff8bc57bb8>] entry_SYSCALL_64_fastpath+0x18/0x78
>  ...
>  ---[ end trace 75346ce7c76b9f06 ]---
> 
> Fixes: 2fc8ce56985d ("ext4: do not iput inode under running transaction in ext4_rename()")
> Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
> ---
>  fs/ext4/namei.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> index f22fcb393684..8cd2a7e1eef1 100644
> --- a/fs/ext4/namei.c
> +++ b/fs/ext4/namei.c
> @@ -3561,7 +3561,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
>  	    !ext4_is_child_context_consistent_with_parent(new.dir,
>  							  old.inode)) {
>  		retval = -EXDEV;
> -		goto end_rename;
> +		goto release_bh;
>  	}
>  
>  	new.bh = ext4_find_entry(new.dir, &new.dentry->d_name,
> -- 
> 2.25.4
> 

So should this also go to 4.14.y and 4.9.y?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 4.4] ext4: correct error label in ext4_rename()
@ 2021-04-23 12:35 Zhang Yi
  2021-04-23 12:34 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Zhang Yi @ 2021-04-23 12:35 UTC (permalink / raw)
  To: stable; +Cc: gregkh, tytso, sashal, yi.zhang

The backport of upstream patch 5dccdc5a1916 ("ext4: do not iput inode
under running transaction in ext4_rename()") introduced a regression on
the stable kernels 4.14 and older. One of the end_rename error label was
forgetting to change to release_bh, which may trigger below bug.

 ------------[ cut here ]------------
 kernel BUG at /home/zhangyi/hulk-4.4/fs/ext4/ext4_jbd2.c:30!
 ...
 Call Trace:
  [<ffffffff8b4207b2>] ext4_rename+0x9e2/0x10c0
  [<ffffffff8b331324>] ? unlazy_walk+0x124/0x2a0
  [<ffffffff8b420eb5>] ext4_rename2+0x25/0x60
  [<ffffffff8b335104>] vfs_rename+0x3a4/0xed0
  [<ffffffff8b33a7ad>] SYSC_renameat2+0x57d/0x7f0
  [<ffffffff8b33c119>] SyS_renameat+0x19/0x30
  [<ffffffff8bc57bb8>] entry_SYSCALL_64_fastpath+0x18/0x78
 ...
 ---[ end trace 75346ce7c76b9f06 ]---

Fixes: 2fc8ce56985d ("ext4: do not iput inode under running transaction in ext4_rename()")
Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
---
 fs/ext4/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index f22fcb393684..8cd2a7e1eef1 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -3561,7 +3561,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
 	    !ext4_is_child_context_consistent_with_parent(new.dir,
 							  old.inode)) {
 		retval = -EXDEV;
-		goto end_rename;
+		goto release_bh;
 	}
 
 	new.bh = ext4_find_entry(new.dir, &new.dentry->d_name,
-- 
2.25.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 4.4] ext4: correct error label in ext4_rename()
  2021-04-23 12:34 ` Greg KH
@ 2021-04-23 12:56   ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2021-04-23 12:56 UTC (permalink / raw)
  To: Zhang Yi; +Cc: stable, tytso, sashal

On Fri, Apr 23, 2021 at 02:34:57PM +0200, Greg KH wrote:
> On Fri, Apr 23, 2021 at 08:35:07PM +0800, Zhang Yi wrote:
> > The backport of upstream patch 5dccdc5a1916 ("ext4: do not iput inode
> > under running transaction in ext4_rename()") introduced a regression on
> > the stable kernels 4.14 and older. One of the end_rename error label was
> > forgetting to change to release_bh, which may trigger below bug.
> > 
> >  ------------[ cut here ]------------
> >  kernel BUG at /home/zhangyi/hulk-4.4/fs/ext4/ext4_jbd2.c:30!
> >  ...
> >  Call Trace:
> >   [<ffffffff8b4207b2>] ext4_rename+0x9e2/0x10c0
> >   [<ffffffff8b331324>] ? unlazy_walk+0x124/0x2a0
> >   [<ffffffff8b420eb5>] ext4_rename2+0x25/0x60
> >   [<ffffffff8b335104>] vfs_rename+0x3a4/0xed0
> >   [<ffffffff8b33a7ad>] SYSC_renameat2+0x57d/0x7f0
> >   [<ffffffff8b33c119>] SyS_renameat+0x19/0x30
> >   [<ffffffff8bc57bb8>] entry_SYSCALL_64_fastpath+0x18/0x78
> >  ...
> >  ---[ end trace 75346ce7c76b9f06 ]---
> > 
> > Fixes: 2fc8ce56985d ("ext4: do not iput inode under running transaction in ext4_rename()")
> > Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
> > ---
> >  fs/ext4/namei.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> > index f22fcb393684..8cd2a7e1eef1 100644
> > --- a/fs/ext4/namei.c
> > +++ b/fs/ext4/namei.c
> > @@ -3561,7 +3561,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
> >  	    !ext4_is_child_context_consistent_with_parent(new.dir,
> >  							  old.inode)) {
> >  		retval = -EXDEV;
> > -		goto end_rename;
> > +		goto release_bh;
> >  	}
> >  
> >  	new.bh = ext4_find_entry(new.dir, &new.dentry->d_name,
> > -- 
> > 2.25.4
> > 
> 
> So should this also go to 4.14.y and 4.9.y?

Ah, you already did that, sorry for the noise.

And thanks for the patches, will go queue them up now, much appreciated.

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-23 12:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-23 12:35 [PATCH 4.4] ext4: correct error label in ext4_rename() Zhang Yi
2021-04-23 12:34 ` Greg KH
2021-04-23 12:56   ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.