]> git.baikalelectronics.ru Git - kernel.git/commit
hfsplus: handle more on-disk corruptions without oopsing
authorEric Sandeen <sandeen@redhat.com>
Thu, 14 Oct 2010 13:53:48 +0000 (09:53 -0400)
committerChristoph Hellwig <hch@lst.de>
Thu, 14 Oct 2010 13:53:48 +0000 (09:53 -0400)
commitf2eb5ff4d7db64ad5cbb5fee1153abb09b02fb13
treef8a93ca47166f79cfa90e3dbc3c4f403686e2fbb
parent1d9872886f3a9a3959510ebb92aaa5971ba62f4e
hfsplus: handle more on-disk corruptions without oopsing

hfs seems prone to bad things when it encounters on disk corruption.  Many
values are read from disk, and used as lengths to memcpy, as an example.
This patch fixes up several of these problematic cases.

o sanity check the on-disk maximum key lengths on mount
  (these are set to a defined value at mkfs time and shouldn't differ)
o check on-disk node keylens against the maximum key length for each tree
o fix hfs_btree_open so that going out via free_tree: doesn't wind
  up in hfs_releasepage, which wants to follow the very pointer
  we were trying to set up:
HFS_SB(sb)->cat_tree = hfs_btree_open()
    .
  failure gets to hfs_releasepage and tries to follow HFS_SB(sb)->cat_tree

Tested with the fsfuzzer; it survives more than it used to.

[hch: ported of commit e56f07f3307471f3debd6d1ff07bc3e85b020afa from hfs]
[hch: added the fixes from 5581d018ed3493d226e7a4d645d9c8a5af6c36b]

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Christoph Hellwig <hch@tuxera.com>
fs/hfsplus/bfind.c
fs/hfsplus/brec.c
fs/hfsplus/btree.c
fs/hfsplus/hfsplus_raw.h