linux-stable/fs/hfs
Colin Ian King 218e302c82 fs/hfs/extent.c: fix array out of bounds read of array extent
[ Upstream commit 6c9a3f843a ]

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/20180831140538.31566-1-colin.king@canonical.com
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Ernesto A. Fernndez <ernesto.mnd.fernandez@gmail.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Hin-Tak Leung <htl10@users.sourceforge.net>
Cc: Vyacheslav Dubeyko <slava@dubeyko.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-11-28 18:28:50 +01:00
..
attr.c hfs: Switch to generic xattr handlers 2016-10-06 22:17:38 -04:00
bfind.c
bitmap.c
bnode.c mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros 2016-04-04 10:41:08 -07:00
brec.c hfs: fix BUG on bnode parent update 2019-11-28 18:28:46 +01:00
btree.c hfs: prevent btree data loss on ENOSPC 2019-11-28 18:28:48 +01:00
btree.h hfs: prevent btree data loss on ENOSPC 2019-11-28 18:28:48 +01:00
catalog.c hfs: prevent btree data loss on ENOSPC 2019-11-28 18:28:48 +01:00
dir.c Merge remote-tracking branch 'ovl/rename2' into for-linus 2016-10-10 23:02:51 -04:00
extent.c fs/hfs/extent.c: fix array out of bounds read of array extent 2019-11-28 18:28:50 +01:00
hfs.h
hfs_fs.h hfs: Switch to generic xattr handlers 2016-10-06 22:17:38 -04:00
inode.c hfs: update timestamp on truncate() 2019-11-28 18:28:50 +01:00
Kconfig
Makefile
mdb.c HFS wants 8Kb per-superblock allocation; just use kmalloc() 2016-01-04 10:29:34 -05:00
part_tbl.c
string.c get rid of 'parent' argument of ->d_compare() 2016-07-31 16:37:25 -04:00
super.c hfs: Switch to generic xattr handlers 2016-10-06 22:17:38 -04:00
sysdep.c VFS: normal filesystems (and lustre): d_inode() annotations 2015-04-15 15:06:57 -04:00
trans.c qstr: constify instances in hfs 2016-07-20 23:30:06 -04:00