Skip to content

Commit 996fc44

Browse files
committed
ext4: add missing error check in __ext4_new_inode()
It's possible for ext4_get_acl() to return an ERR_PTR. So we need to add a check for this case in __ext4_new_inode(). Otherwise on an error we can end up oops the kernel. This was getting triggered by xfstests generic/388, which is a test which exercises the shutdown code path. Signed-off-by: Theodore Ts'o <[email protected]> Cc: [email protected]
1 parent c894aa9 commit 996fc44

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/ext4/ialloc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,8 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir,
816816
#ifdef CONFIG_EXT4_FS_POSIX_ACL
817817
struct posix_acl *p = get_acl(dir, ACL_TYPE_DEFAULT);
818818

819+
if (IS_ERR(p))
820+
return ERR_CAST(p);
819821
if (p) {
820822
int acl_size = p->a_count * sizeof(ext4_acl_entry);
821823

0 commit comments

Comments
 (0)