Skip to content

Commit f31173c

Browse files
niejtytso
authored andcommitted
ext4: refuse to create ea block when umounted
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: [email protected] Link: https://syzkaller.appspot.com/bug?id=3613786cb88c93aa1c6a279b1df6a7b201347d08 Link: https://lore.kernel.org/r/[email protected] Cc: [email protected] Signed-off-by: Jun Nie <[email protected]> Signed-off-by: Theodore Ts'o <[email protected]>
1 parent 1e9d62d commit f31173c

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
@@ -1471,6 +1471,13 @@ static struct inode *ext4_xattr_inode_create(handle_t *handle,
14711471
uid_t owner[2] = { i_uid_read(inode), i_gid_read(inode) };
14721472
int err;
14731473

1474+
if (inode->i_sb->s_root == NULL) {
1475+
ext4_warning(inode->i_sb,
1476+
"refuse to create EA inode when umounting");
1477+
WARN_ON(1);
1478+
return ERR_PTR(-EINVAL);
1479+
}
1480+
14741481
/*
14751482
* Let the next inode be the goal, so we try and allocate the EA inode
14761483
* in the same group, or nearby one.

0 commit comments

Comments
 (0)