mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ocfs2: free inode when ocfs2_get_init_inode() fails
@ 2024-11-23 13:28 Tetsuo Handa
  2024-11-24  8:36 ` Joseph Qi
  0 siblings, 1 reply; 2+ messages in thread
From: Tetsuo Handa @ 2024-11-23 13:28 UTC (permalink / raw)
  To: ocfs2-devel; +Cc: LKML, Junxiao Bi, Jan Kara

syzbot is reporting busy inodes after unmount, for commit 9c89fe0af826
("ocfs2: Handle error from dquot_initialize()") forgot to call iput()
when new_inode() succeeded and dquot_initialize() failed.

Reported-by: syzbot+0af00f6a2cba2058b5db@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=0af00f6a2cba2058b5db
Tested-by: syzbot+0af00f6a2cba2058b5db@syzkaller.appspotmail.com
Fixes: 9c89fe0af826 ("ocfs2: Handle error from dquot_initialize()")
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
---
 fs/ocfs2/namei.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index 59c92353151a..5550f8afa438 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -200,8 +200,10 @@ static struct inode *ocfs2_get_init_inode(struct inode *dir, umode_t mode)
 	mode = mode_strip_sgid(&nop_mnt_idmap, dir, mode);
 	inode_init_owner(&nop_mnt_idmap, inode, dir, mode);
 	status = dquot_initialize(inode);
-	if (status)
+	if (status) {
+		iput(inode);
 		return ERR_PTR(status);
+	}
 
 	return inode;
 }
-- 
2.47.0

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

* Re: [PATCH] ocfs2: free inode when ocfs2_get_init_inode() fails
  2024-11-23 13:28 [PATCH] ocfs2: free inode when ocfs2_get_init_inode() fails Tetsuo Handa
@ 2024-11-24  8:36 ` Joseph Qi
  0 siblings, 0 replies; 2+ messages in thread
From: Joseph Qi @ 2024-11-24  8:36 UTC (permalink / raw)
  To: Tetsuo Handa, akpm; +Cc: LKML, Junxiao Bi, Jan Kara, ocfs2-devel



On 11/23/24 9:28 PM, Tetsuo Handa wrote:
> syzbot is reporting busy inodes after unmount, for commit 9c89fe0af826
> ("ocfs2: Handle error from dquot_initialize()") forgot to call iput()
> when new_inode() succeeded and dquot_initialize() failed.
> 
> Reported-by: syzbot+0af00f6a2cba2058b5db@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=0af00f6a2cba2058b5db
> Tested-by: syzbot+0af00f6a2cba2058b5db@syzkaller.appspotmail.com
> Fixes: 9c89fe0af826 ("ocfs2: Handle error from dquot_initialize()")
> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>

Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
> ---
>  fs/ocfs2/namei.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
> index 59c92353151a..5550f8afa438 100644
> --- a/fs/ocfs2/namei.c
> +++ b/fs/ocfs2/namei.c
> @@ -200,8 +200,10 @@ static struct inode *ocfs2_get_init_inode(struct inode *dir, umode_t mode)
>  	mode = mode_strip_sgid(&nop_mnt_idmap, dir, mode);
>  	inode_init_owner(&nop_mnt_idmap, inode, dir, mode);
>  	status = dquot_initialize(inode);
> -	if (status)
> +	if (status) {
> +		iput(inode);
>  		return ERR_PTR(status);
> +	}
>  
>  	return inode;
>  }


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

end of thread, other threads:[~2024-11-24  8:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-23 13:28 [PATCH] ocfs2: free inode when ocfs2_get_init_inode() fails Tetsuo Handa
2024-11-24  8:36 ` Joseph Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®