diff options
author | Dongliang Mu <mudongliangabcd@gmail.com> | 2022-08-16 12:08:58 +0800 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2022-09-01 17:30:24 -0400 |
commit | 2e488f13755ffbb60f307e991b27024716a33b29 (patch) | |
tree | fa967a2ec7ee9bfdfddba2f6e73f91d7bbff075c /fs/nfsd/nfssvc.c | |
parent | 568035b01cfb107af8d2e4bd2fb9aea22cf5b868 (diff) |
fs: fix UAF/GPF bug in nilfs_mdt_destroy
In alloc_inode, inode_init_always() could return -ENOMEM if
security_inode_alloc() fails, which causes inode->i_private
uninitialized. Then nilfs_is_metadata_file_inode() returns
true and nilfs_free_inode() wrongly calls nilfs_mdt_destroy(),
which frees the uninitialized inode->i_private
and leads to crashes(e.g., UAF/GPF).
Fix this by moving security_inode_alloc just prior to
this_cpu_inc(nr_inodes)
Link: https://lkml.kernel.org/r/CAFcO6XOcf1Jj2SeGt=jJV59wmhESeSKpfR0omdFRq+J9nD1vfQ@mail.gmail.com
Reported-by: butt3rflyh4ck <butterflyhuangxx@gmail.com>
Reported-by: Hao Sun <sunhao.th@gmail.com>
Reported-by: Jiacheng Xu <stitch@zju.edu.cn>
Reviewed-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: stable@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/nfsd/nfssvc.c')
0 files changed, 0 insertions, 0 deletions