Skip to content

Commit

Permalink
[XFS] Fix use-after-free during log unmount.
Browse files Browse the repository at this point in the history
Don't reference the log buffer after running the callbacks as the callback
can trigger the log buffers to be freed during unmount.

SGI-PV: 964545
SGI-Modid: xfs-linux-melb:xfs-kern:28567a

Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Tim Shimmin <tes@sgi.com>
  • Loading branch information
David Chinner authored and Tim Shimmin committed Jul 14, 2007
1 parent 40095b6 commit 3db296f
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions fs/xfs/xfs_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -967,14 +967,16 @@ xlog_iodone(xfs_buf_t *bp)
} else if (iclog->ic_state & XLOG_STATE_IOERROR) {
aborted = XFS_LI_ABORTED;
}

/* log I/O is always issued ASYNC */
ASSERT(XFS_BUF_ISASYNC(bp));
xlog_state_done_syncing(iclog, aborted);
if (!(XFS_BUF_ISASYNC(bp))) {
/*
* Corresponding psema() will be done in bwrite(). If we don't
* vsema() here, panic.
*/
XFS_BUF_V_IODONESEMA(bp);
}
/*
* do not reference the buffer (bp) here as we could race
* with it being freed after writing the unmount record to the
* log.
*/

} /* xlog_iodone */

/*
Expand Down

0 comments on commit 3db296f

Please sign in to comment.