Skip to content
This repository was archived by the owner on Dec 2, 2020. It is now read-only.

Commit 218e302

Browse files
Colin Ian Kinggregkh
Colin Ian King
authored andcommitted
fs/hfs/extent.c: fix array out of bounds read of array extent
[ Upstream commit 6c9a3f843a29d6894dfc40df338b91dbd78f0ae3 ] 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]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 79fb2b8 commit 218e302

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/hfs/extent.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ int hfs_free_fork(struct super_block *sb, struct hfs_cat_file *file, int type)
304304
return 0;
305305

306306
blocks = 0;
307-
for (i = 0; i < 3; extent++, i++)
307+
for (i = 0; i < 3; i++)
308308
blocks += be16_to_cpu(extent[i].count);
309309

310310
res = hfs_free_extents(sb, extent, blocks, blocks);

0 commit comments

Comments
 (0)