Whamcloud - gitweb
e2fsck: pass2 should not process directory blocks that are impossibly large
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 25 Jul 2014 12:41:11 +0000 (08:41 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 25 Jul 2014 12:41:11 +0000 (08:41 -0400)
commitc28c2741ba5af0fde93b50f992c525fea5b05cf6
tree71c88ff7bb5c91c4b9569bd3282bdb00820b4691
parent0733835bf79748fb99aa19ad4a2bfa5b51ba2708
e2fsck: pass2 should not process directory blocks that are impossibly large

Currently, directories cannot be fallocated, which means that the only
way they get bigger is for the kernel to append blocks one by one.
Therefore, if we encounter a logical block offset that is too big, we
needn't bother adding it to the dblist for pass2 processing, because
it's unlikely to contain a valid directory block.  The code that
handles extent based directories also does not add toobig blocks to
the dblist.

Note that we can easily cause e2fsck to fail with ENOMEM if we start
feeding it really large logical block offsets, as the dblist
implementation will try to realloc() an array big enough to hold it.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2fsck/pass1.c
tests/f_hugedir_blocks/expect.1 [new file with mode: 0644]
tests/f_hugedir_blocks/expect.2 [new file with mode: 0644]
tests/f_hugedir_blocks/image.gz [new file with mode: 0644]
tests/f_hugedir_blocks/name [new file with mode: 0644]