Skip to content

Commit 3c4f884

Browse files
niejTreehugger Robot
authored andcommitted
UPSTREAM: ext4: refuse to create ea block when umounted
commit f31173c19901a96bb2ebf6bcfec8a08df7095c91 upstream. The ea block expansion need to access s_root while it is already set as NULL when umount is triggered. Refuse this request to avoid panic. Reported-by: syzbot+2dacb8f015bf1420155f@syzkaller.appspotmail.com Link: https://syzkaller.appspot.com/bug?id=3613786cb88c93aa1c6a279b1df6a7b201347d08 Link: https://lore.kernel.org/r/20230103014517.495275-3-jun.nie@linaro.org Cc: stable@kernel.org Signed-off-by: Jun Nie <jun.nie@linaro.org> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Bug: 262267471 Change-Id: I0a5c974e696cf7a132f3cbb8acbe066edba4660f Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
1 parent 0473082 commit 3c4f884

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

fs/ext4/xattr.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,6 +1422,13 @@ static struct inode *ext4_xattr_inode_create(handle_t *handle,
14221422
uid_t owner[2] = { i_uid_read(inode), i_gid_read(inode) };
14231423
int err;
14241424

1425+
if (inode->i_sb->s_root == NULL) {
1426+
ext4_warning(inode->i_sb,
1427+
"refuse to create EA inode when umounting");
1428+
WARN_ON(1);
1429+
return ERR_PTR(-EINVAL);
1430+
}
1431+
14251432
/*
14261433
* Let the next inode be the goal, so we try and allocate the EA inode
14271434
* in the same group, or nearby one.

0 commit comments

Comments
 (0)