public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix use after free when closing log/rt devices
@ 2008-06-27  5:14 Lachlan McIlroy
  2008-06-27  6:32 ` Christoph Hellwig
  0 siblings, 1 reply; 7+ messages in thread
From: Lachlan McIlroy @ 2008-06-27  5:14 UTC (permalink / raw)
  To: xfs-dev, xfs-oss

The call to xfs_free_buftarg() will free the memory used by it's argument
so we need to save the bdev to pass to xfs_blkdev_put()

Lachlan

--- fs/xfs/linux-2.6/xfs_super.c_1.432	2008-06-27 14:51:17.000000000 +1000
+++ fs/xfs/linux-2.6/xfs_super.c	2008-06-27 14:59:26.000000000 +1000
@@ -781,13 +781,17 @@ STATIC void
 xfs_close_devices(
 	struct xfs_mount	*mp)
 {
+	struct block_device	*bdev;
+
 	if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) {
+		bdev = mp->m_logdev_targp->bt_bdev;
 		xfs_free_buftarg(mp->m_logdev_targp);
-		xfs_blkdev_put(mp->m_logdev_targp->bt_bdev);
+		xfs_blkdev_put(bdev);
 	}
 	if (mp->m_rtdev_targp) {
+		bdev = mp->m_rtdev_targp->bt_bdev;
 		xfs_free_buftarg(mp->m_rtdev_targp);
-		xfs_blkdev_put(mp->m_rtdev_targp->bt_bdev);
+		xfs_blkdev_put(bdev);
 	}
 	xfs_free_buftarg(mp->m_ddev_targp);
 }

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-07-02  2:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-27  5:14 [PATCH] Fix use after free when closing log/rt devices Lachlan McIlroy
2008-06-27  6:32 ` Christoph Hellwig
2008-06-27  6:39   ` Mark Goodwin
2008-06-27  9:08     ` Christoph Hellwig
2008-07-02  1:59       ` Timothy Shimmin
2008-07-02  2:54         ` Dave Chinner
2008-07-01  6:21   ` Lachlan McIlroy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox