Skip to content

Commit bf8fb19

Browse files
Tetsuo Handamehmetb0
authored andcommitted
ocfs2: free inode when ocfs2_get_init_inode() fails
BugLink: https://bugs.launchpad.net/bugs/2095283 [ Upstream commit 965b5dd1894f4525f38c1b5f99b0106a07dbb5db ] syzbot is reporting busy inodes after unmount, for commit 9c89fe0 ("ocfs2: Handle error from dquot_initialize()") forgot to call iput() when new_inode() succeeded and dquot_initialize() failed. Link: https://lkml.kernel.org/r/e68c0224-b7c6-4784-b4fa-a9fc8c675525@I-love.SAKURA.ne.jp Fixes: 9c89fe0 ("ocfs2: Handle error from dquot_initialize()") Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Reported-by: syzbot+0af00f6a2cba2058b5db@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=0af00f6a2cba2058b5db Tested-by: syzbot+0af00f6a2cba2058b5db@syzkaller.appspotmail.com Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com> Cc: Mark Fasheh <mark@fasheh.com> Cc: Joel Becker <jlbec@evilplan.org> Cc: Junxiao Bi <junxiao.bi@oracle.com> Cc: Changwei Ge <gechangwei@live.cn> Cc: Jun Piao <piaojun@huawei.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org> CVE-2024-56630 Signed-off-by: Koichiro Den <koichiro.den@canonical.com>
1 parent 2e6ea5a commit bf8fb19

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fs/ocfs2/namei.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,10 @@ static struct inode *ocfs2_get_init_inode(struct inode *dir, umode_t mode)
200200
mode = mode_strip_sgid(&init_user_ns, dir, mode);
201201
inode_init_owner(&init_user_ns, inode, dir, mode);
202202
status = dquot_initialize(inode);
203-
if (status)
203+
if (status) {
204+
iput(inode);
204205
return ERR_PTR(status);
206+
}
205207

206208
return inode;
207209
}

0 commit comments

Comments
 (0)