Commit 5cd7402
ext4: fail ext4_iget if special inode unallocated
In ext4_fill_super(), EXT4_ORPHAN_FS flag is cleared after
ext4_orphan_cleanup() is executed. Therefore, when __ext4_iget() is
called to get an inode whose i_nlink is 0 when the flag exists, no error
is returned. If the inode is a special inode, a null pointer dereference
may occur. If the value of i_nlink is 0 for any inodes (except boot loader
inodes) got by using the EXT4_IGET_SPECIAL flag, the current file system
is corrupted. Therefore, make the ext4_iget() function return an error if
it gets such an abnormal special inode.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=199179
Link: https://bugzilla.kernel.org/show_bug.cgi?id=216541
Link: https://bugzilla.kernel.org/show_bug.cgi?id=216539
Reported-by: Luís Henriques <lhenriques@suse.de>
Suggested-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Baokun Li <libaokun1@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230107032126.4165860-2-libaokun1@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>1 parent d99a55a commit 5cd7402
1 file changed
Lines changed: 8 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4872 | 4872 | | |
4873 | 4873 | | |
4874 | 4874 | | |
4875 | | - | |
4876 | | - | |
4877 | | - | |
4878 | | - | |
4879 | | - | |
4880 | | - | |
4881 | | - | |
4882 | 4875 | | |
4883 | 4876 | | |
4884 | 4877 | | |
| |||
4951 | 4944 | | |
4952 | 4945 | | |
4953 | 4946 | | |
4954 | | - | |
| 4947 | + | |
4955 | 4948 | | |
4956 | 4949 | | |
4957 | | - | |
4958 | | - | |
| 4950 | + | |
| 4951 | + | |
| 4952 | + | |
| 4953 | + | |
| 4954 | + | |
| 4955 | + | |
| 4956 | + | |
4959 | 4957 | | |
4960 | 4958 | | |
4961 | 4959 | | |
| |||
0 commit comments