xfs: sanity check attr fork size
authorChristoph Hellwig <hch@lst.de>
Mon, 19 Jan 2009 01:04:16 +0000 (02:04 +0100)
committerChristoph Hellwig <hch@brick.lst.de>
Mon, 19 Jan 2009 01:04:16 +0000 (02:04 +0100)
commit2809f76afce05a73e08120f455107912aa519647
tree7c5ae07404c59571d120dc8e2fa2e33db54b8e7d
parent7884bc8617e6b8afda8cb8853cf14abfd3148d5c
xfs: sanity check attr fork size

Recently we have quite a few kerneloops reports about dereferencing a NULL
if_data in the attribute fork.  From looking over the code this can only
happen if we pass a 0 size argument to xfs_iformat_local.  This implies some
sort of corruption and in fact the only mailinglist report about this from
earlier this year was after a powerfail presumably on a system with write
cache and without barriers.

Add a quick sanity check for the attr fork size in xfs_iformat to catch
these early and without an oops.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <david@fromorbit.com>
fs/xfs/xfs_inode.c