diff options
author | Zhang Yi <yi.zhang@huawei.com> | 2021-09-01 10:09:55 +0800 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2021-11-04 10:33:25 -0400 |
commit | de01f484576d29b02fb2856387f29cfdf5ad4f19 (patch) | |
tree | 570603162bc425cfabdbbc889bbb22aab6e6b6b9 /lib/test_fortify/write_overflow-memmove.c | |
parent | 9a1bf32c8e12b7768325e83e9b9eeb69c46435b3 (diff) |
ext4: prevent getting empty inode buffer
In ext4_get_inode_loc(), we may skip IO and get an zero && uptodate
inode buffer when the inode monopolize an inode block for performance
reason. For most cases, ext4_mark_iloc_dirty() will fill the inode
buffer to make it fine, but we could miss this call if something bad
happened. Finally, __ext4_get_inode_loc_noinmem() may probably get an
empty inode buffer and trigger ext4 error.
For example, if we remove a nonexistent xattr on inode A,
ext4_xattr_set_handle() will return ENODATA before invoking
ext4_mark_iloc_dirty(), it will left an uptodate but zero buffer. We
will get checksum error message in ext4_iget() when getting inode again.
EXT4-fs error (device sda): ext4_lookup:1784: inode #131074: comm cat: iget: checksum invalid
Even worse, if we allocate another inode B at the same inode block, it
will corrupt the inode A on disk when write back inode B.
So this patch initialize the inode buffer by filling the in-mem inode
contents if we skip read I/O, ensure that the buffer is really uptodate.
Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20210901020955.1657340-4-yi.zhang@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'lib/test_fortify/write_overflow-memmove.c')
0 files changed, 0 insertions, 0 deletions