summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorCorentin GUILLEVIC <corentin.guillevic@smile.fr>2023-03-17 15:15:12 +0300
committerTom Rini <trini@konsulko.com>2023-03-30 22:09:59 +0300
commit39409fac2c9d9f3cc9cb23b88502b5ff08887339 (patch)
tree13b9182c82c79f825ce66bf05a6d27110b3f98c6 /fs
parentfefd949157430e1dc8569fa39729c63c5eccb454 (diff)
downloadu-boot-39409fac2c9d9f3cc9cb23b88502b5ff08887339.tar.xz
fs: ext4: fix files seen as symlink during deletion
The deletion process handles special case for symlinks whose target are small enough that it fits in struct ext2_inode.b.symlink. So no block had been allocated. But the check of file type wrongly considered regular files as symlink. So, no block was freed. So, the EXT4 partition could be corrupted because of no free block available. Signed-off-by: Corentin GUILLEVIC <corentin.guillevic@smile.fr>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/ext4_write.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ext4/ext4_write.c b/fs/ext4/ext4_write.c
index f22af45d1b..ea4c5d4157 100644
--- a/fs/ext4/ext4_write.c
+++ b/fs/ext4/ext4_write.c
@@ -473,7 +473,7 @@ static int ext4fs_delete_file(int inodeno)
* special case for symlinks whose target are small enough that
*it fits in struct ext2_inode.b.symlink: no block had been allocated
*/
- if ((le16_to_cpu(inode.mode) & S_IFLNK) &&
+ if (S_ISLNK(le16_to_cpu(inode.mode)) &&
le32_to_cpu(inode.size) <= sizeof(inode.b.symlink)) {
no_blocks = 0;
}