Skip to content

Commit 2c2ea94

Browse files
Lukas Czernerjankara
authored andcommitted
ext3: Return -EINVAL when start is beyond the end of fs in ext3_trim_fs()
We should return -EINVAL when the FITRIM parameters are not sane, but currently we are exiting silently if start is beyond the end of the file system. This commit fixes this so we return -EINVAL as other file systems do. Signed-off-by: Lukas Czerner <lczerner@redhat.com> CC: Jan Kara <jack@suse.cz> Signed-off-by: Jan Kara <jack@suse.cz>
1 parent 81fe8c6 commit 2c2ea94

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

‎fs/ext3/balloc.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2108,7 +2108,7 @@ int ext3_trim_fs(struct super_block *sb, struct fstrim_range *range)
21082108
if (unlikely(minlen > EXT3_BLOCKS_PER_GROUP(sb)))
21092109
return -EINVAL;
21102110
if (start >= max_blks)
2111-
goto out;
2111+
return -EINVAL;
21122112
if (start + len > max_blks)
21132113
len = max_blks - start;
21142114

@@ -2156,8 +2156,6 @@ int ext3_trim_fs(struct super_block *sb, struct fstrim_range *range)
21562156

21572157
if (ret >= 0)
21582158
ret = 0;
2159-
2160-
out:
21612159
range->len = trimmed * sb->s_blocksize;
21622160

21632161
return ret;

0 commit comments

Comments
 (0)