]> err.no Git - linux-2.6/commitdiff
[XFS] Fix a buffer refcount leak in dir2 code on a forced shutdown.
authorNathan Scott <nathans@sgi.com>
Fri, 9 Jun 2006 04:58:48 +0000 (14:58 +1000)
committerNathan Scott <nathans@sgi.com>
Fri, 9 Jun 2006 04:58:48 +0000 (14:58 +1000)
SGI-PV: 904196
SGI-Modid: xfs-linux-melb:xfs-kern:26097a

Signed-off-by: Nathan Scott <nathans@sgi.com>
fs/xfs/xfs_dir2_node.c

index c0e8fcf5e13f1db0ab7d60bb0376c1db9b5e8d37..a8d483c0a84ceea67faef7b7980e40a59fcfc774 100644 (file)
@@ -505,7 +505,6 @@ xfs_dir2_leafn_lookup_int(
                                                        XFS_DATA_FORK))) {
                                                return error;
                                        }
-                                       curfdb = newfdb;
                                        free = curbp->data;
                                        ASSERT(be32_to_cpu(free->hdr.magic) ==
                                               XFS_DIR2_FREE_MAGIC);
@@ -527,8 +526,11 @@ xfs_dir2_leafn_lookup_int(
                                if (unlikely(be16_to_cpu(free->bests[fi]) == NULLDATAOFF)) {
                                        XFS_ERROR_REPORT("xfs_dir2_leafn_lookup_int",
                                                         XFS_ERRLEVEL_LOW, mp);
+                                       if (curfdb != newfdb)
+                                               xfs_da_brelse(tp, curbp);
                                        return XFS_ERROR(EFSCORRUPTED);
                                }
+                               curfdb = newfdb;
                                if (be16_to_cpu(free->bests[fi]) >= length) {
                                        *indexp = index;
                                        state->extravalid = 1;