]> err.no Git - linux-2.6/commitdiff
[XFS] fix use after free with external logs or real-time devices
authorLachlan McIlroy <lachlan@sgi.com>
Fri, 18 Jul 2008 07:13:12 +0000 (17:13 +1000)
committerNiv Sardi <xaiki@debian.org>
Mon, 28 Jul 2008 06:59:34 +0000 (16:59 +1000)
SGI-PV: 983806

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

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

index b400866800474d25fbac0448f1aeb8a005e33929..30ae96397e318854ab0eb93ecc124916e04bfde5 100644 (file)
@@ -792,12 +792,14 @@ xfs_close_devices(
        struct xfs_mount        *mp)
 {
        if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) {
+               struct block_device *logdev = 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(logdev);
        }
        if (mp->m_rtdev_targp) {
+               struct block_device *rtdev = 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(rtdev);
        }
        xfs_free_buftarg(mp->m_ddev_targp);
 }