[XFS] Prevent use-after-free caused by synchronous inode reclaim
authorDavid Chinner <david@fromorbit.com>
Thu, 30 Oct 2008 06:36:40 +0000 (17:36 +1100)
committerLachlan McIlroy <lachlan@sgi.com>
Thu, 30 Oct 2008 06:36:40 +0000 (17:36 +1100)
commit99fa8cb3c580d4445fe8fc239454e8f37a3b6847
tree88b539774448ce3958d264f4a50a821d0dcde6f4
parentbf904248a2adb3f3be4eb4fb1837ce3bb28cca76
[XFS] Prevent use-after-free caused by synchronous inode reclaim

With the combined linux and XFS inode, we need to ensure that the combined
structure is not freed before the generic code is finished with the inode.
As it turns out, there is a case where the XFS inode is freed before the
linux inode - when xfs_reclaim() is called from ->clear_inode() on a clean
inode, the xfs inode is freed during that call. The generic code
references the inode after the ->clear_inode() call, so this is a use
after free situation.

Fix the problem by moving the xfs_reclaim() call to ->destroy_inode()
instead of in ->clear_inode(). This ensures the combined inode structure
is not freed until after the generic code has finished with it.

SGI-PV: 988141

SGI-Modid: xfs-linux-melb:xfs-kern:32324a

Signed-off-by: David Chinner <david@fromorbit.com>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Signed-off-by: Christoph Hellwig <hch@infradead.org>
fs/xfs/linux-2.6/xfs_super.c