[Top] [All Lists]

Re: [PATCH] Fix use-after-free with log and quotas

To: Lachlan McIlroy <lachlan@xxxxxxx>, xfs-dev <xfs-dev@xxxxxxx>, xfs-oss <xfs@xxxxxxxxxxx>
Subject: Re: [PATCH] Fix use-after-free with log and quotas
From: Lachlan McIlroy <lachlan@xxxxxxx>
Date: Mon, 15 Sep 2008 12:40:04 +1000
In-reply-to: <20080913040219.GA5811@disturbed>
References: <48CA2B23.4020405@xxxxxxx> <20080913040219.GA5811@disturbed>
Reply-to: lachlan@xxxxxxx
User-agent: Thunderbird (X11/20080707)
Dave Chinner wrote:
On Fri, Sep 12, 2008 at 06:41:07PM +1000, Lachlan McIlroy wrote:
Destroying the quota stuff on unmount can access the log - ie XFS_QM_DONE()
ends up in xfs_dqunlock() which calls xfs_trans_unlocked_item() and then
xfs_log_move_tail().  By this time the log has already been destroyed.
Just move the cleanup of the quota code earlier in xfs_unmountfs() before
the call to xfs_log_unmount().  Moving XFS_QM_DONE() up near
XFS_QM_DQPURGEALL() seems like a good spot.

FWIW, has this been actually seen in the real world?
Yes.  And easy to reproduce too.

xfs_trans_unlocked_item() only does stuff if the log item is in the
AIL. If we've already destroyed the log, then we should have already
torn down the AIL and there should be no log items in the system
that are in the AIL....
That should be the case but clearly not happening.  Pete is investigating
an issue right now where a dquot is not getting removed from the AIL when
it should.  Until we've got to the bottom of that problem I'd prefer to at
least avoid this use after free issue.

<Prev in Thread] Current Thread [Next in Thread>