Whamcloud - gitweb
e2fsck: fix potential segv when handling a read error in a superblock
authorJim Keniston <jkenisto@us.ibm.com>
Mon, 6 Aug 2012 22:46:03 +0000 (18:46 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 6 Aug 2012 22:46:42 +0000 (18:46 -0400)
commitd45b67c5f2a66597d8e2915052e180203a9193b8
treeda75e6d05667a64600d60a98d92faeeab98cae45
parentd5aa6a82b37a0e78d8882601e6ad9da9d9dcb4da
e2fsck: fix potential segv when handling a read error in a superblock

When passed a negative count (indicating a byte count rather than
a block count) e2fsck_handle_read_error() treats the data as a full
block, causing unix_write_blk64() (which can handle negative counts
just fine) to try to write too much.  Given a faulty block device,
this resulted in a SEGV when unix_write_blk64() read past the bottom
of the stack copying the data to cache.  (check_backup_super_block ->
unix_read_blk64 -> raw_read_blk -> e2fsck_handle_read_error)

Reported-by: Alex Friedman <alexfr@il.ibm.com>
Signed-off-by: Jim Keniston <jkenisto@us.ibm.com>
Signed-off-by: Dan Streetman <ddstreet@us.ibm.com>
Reviewed-by: Mingming Cao <mcao@us.ibm.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2fsck/ehandler.c