diff options
author | Colin Ian King <[email protected]> | 2018-10-30 15:06:35 -0700 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2018-10-31 08:54:13 -0700 |
commit | 6c9a3f843a29d6894dfc40df338b91dbd78f0ae3 (patch) | |
tree | 82da08ad2019ceaa7e078fb5f595290950a08bca | |
parent | 8cd3cb5061730af085a3f9890a3352f162b4e20c (diff) |
fs/hfs/extent.c: fix array out of bounds read of array extent
Currently extent and index i are both being incremented causing an array
out of bounds read on extent[i]. Fix this by removing the extraneous
increment of extent.
Ernesto said:
: This is only triggered when deleting a file with a resource fork. I
: may be wrong because the documentation isn't clear, but I don't think
: you can create those under linux. So I guess nobody was testing them.
:
: > A disk space leak, perhaps?
:
: That's what it looks like in general. hfs_free_extents() won't do
: anything if the block count doesn't add up, and the error will be
: ignored. Now, if the block count randomly does add up, we could see
: some corruption.
Detected by CoverityScan, CID#711541 ("Out of bounds read")
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Colin Ian King <[email protected]>
Reviewed-by: Ernesto A. Fernndez <[email protected]>
Cc: David Howells <[email protected]>
Cc: Al Viro <[email protected]>
Cc: Hin-Tak Leung <[email protected]>
Cc: Vyacheslav Dubeyko <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r-- | fs/hfs/extent.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/hfs/extent.c b/fs/hfs/extent.c index 5f1ff97a3b98..263d5028d9d1 100644 --- a/fs/hfs/extent.c +++ b/fs/hfs/extent.c @@ -304,7 +304,7 @@ int hfs_free_fork(struct super_block *sb, struct hfs_cat_file *file, int type) return 0; blocks = 0; - for (i = 0; i < 3; extent++, i++) + for (i = 0; i < 3; i++) blocks += be16_to_cpu(extent[i].count); res = hfs_free_extents(sb, extent, blocks, blocks); |