[Top] [All Lists]

[PATCH] xfsprogs: fix use after free in inode_item_done()

To: xfs-oss <xfs@xxxxxxxxxxx>
Subject: [PATCH] xfsprogs: fix use after free in inode_item_done()
From: Eric Sandeen <sandeen@xxxxxxxxxx>
Date: Mon, 03 Mar 2014 14:41:54 -0600
Delivered-to: xfs@xxxxxxxxxxx
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.3.0
Commit "3a19fb7 libxfs: stop caching inode structures"
introduced a use after free.

libxfs_iput() already does the check for ip->i_itemp, and a
kmem_zone_free() if it's present, and then frees the ip pointer.
Re-checking ip->i_itemp after the libxfs_iput call will access
the freed ip pointer, as will setting ip_>i_itemp to NULL.

Simply remove the offending code to fix this up.

Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>

diff --git a/libxfs/trans.c b/libxfs/trans.c
index 6c9d202..2e6720e 100644
--- a/libxfs/trans.c
+++ b/libxfs/trans.c
@@ -694,7 +694,6 @@ inode_item_done(
        xfs_mount_t             *mp;
        xfs_buf_t               *bp;
        int                     error;
-       extern kmem_zone_t      *xfs_ili_zone;
        ip = iip->ili_inode;
        mp = iip->ili_item.li_mountp;
@@ -739,12 +738,6 @@ ili_done:
        } else {
                libxfs_iput(ip, 0);
-       if (ip->i_itemp)
-               kmem_zone_free(xfs_ili_zone, ip->i_itemp);
-       else
-               ASSERT(0);
-       ip->i_itemp = NULL;
 static void

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