Commit 172e344
ext4: init error handle resource before init group descriptors
Now, 's_err_report' timer is init after ext4_group_desc_init() when fill
super. Theoretically, ext4_group_desc_init() may access to error handle
as follows:
__ext4_fill_super
ext4_group_desc_init
ext4_check_descriptors
ext4_get_group_desc
ext4_error
ext4_handle_error
ext4_commit_super
ext4_update_super
if (!es->s_error_count)
mod_timer(&sbi->s_err_report, jiffies + 24*60*60*HZ);
--> Accessing Uninitialized Variables
timer_setup(&sbi->s_err_report, print_daily_error_info, 0);
Maybe above issue is just theoretical, as ext4_check_descriptors() didn't
judge 'gpd' which get from ext4_get_group_desc(), if access to error handle
ext4_get_group_desc() will return NULL, then will trigger null-ptr-deref in
ext4_check_descriptors().
However, from the perspective of pure code, it is better to initialize
resource that may need to be used first.
Signed-off-by: Ye Bin <yebin10@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230119013711.86680-1-yebin@huaweicloud.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>1 parent 0f7bfd6 commit 172e344
1 file changed
Lines changed: 7 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4738 | 4738 | | |
4739 | 4739 | | |
4740 | 4740 | | |
4741 | | - | |
4742 | 4741 | | |
4743 | 4742 | | |
4744 | 4743 | | |
| |||
4778 | 4777 | | |
4779 | 4778 | | |
4780 | 4779 | | |
4781 | | - | |
4782 | | - | |
| 4780 | + | |
4783 | 4781 | | |
4784 | 4782 | | |
4785 | 4783 | | |
| |||
4788 | 4786 | | |
4789 | 4787 | | |
4790 | 4788 | | |
4791 | | - | |
4792 | | - | |
| 4789 | + | |
4793 | 4790 | | |
| 4791 | + | |
4794 | 4792 | | |
4795 | | - | |
4796 | | - | |
4797 | | - | |
4798 | 4793 | | |
4799 | 4794 | | |
4800 | 4795 | | |
| |||
5220 | 5215 | | |
5221 | 5216 | | |
5222 | 5217 | | |
5223 | | - | |
5224 | | - | |
5225 | | - | |
5226 | | - | |
5227 | 5218 | | |
5228 | 5219 | | |
5229 | 5220 | | |
5230 | 5221 | | |
| 5222 | + | |
| 5223 | + | |
| 5224 | + | |
| 5225 | + | |
5231 | 5226 | | |
5232 | 5227 | | |
5233 | 5228 | | |
| |||
0 commit comments