mirror of
https://xff.cz/git/u-boot/
synced 2025-09-01 16:52:14 +02:00
ext4: Avoid corruption of directories with hash tree indexes
While directories can be read using the old linear scan method, adding a new file would require updating the index tree (alternatively, the whole tree could be removed). Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
This commit is contained in:
@@ -881,6 +881,11 @@ int ext4fs_write(const char *fname, unsigned char *buffer,
|
||||
goto fail;
|
||||
if (ext4fs_iget(parent_inodeno, g_parent_inode))
|
||||
goto fail;
|
||||
/* do not mess up a directory using hash trees */
|
||||
if (le32_to_cpu(g_parent_inode->flags) & EXT4_INDEX_FL) {
|
||||
printf("hash tree directory\n");
|
||||
goto fail;
|
||||
}
|
||||
/* check if the filename is already present in root */
|
||||
existing_file_inodeno = ext4fs_filename_unlink(filename);
|
||||
if (existing_file_inodeno != -1) {
|
||||
|
Reference in New Issue
Block a user