xfs: fix allocbt cursor leak in xfs_alloc_ag_vextent_near
authorDave Chinner <[email protected]>
Tue, 12 Jun 2012 04:20:26 +0000 (14:20 +1000)
committerBen Myers <[email protected]>
Thu, 21 Jun 2012 17:32:43 +0000 (12:32 -0500)
When we fail to find an matching extent near the requested extent
specification during a left-right distance search in
xfs_alloc_ag_vextent_near, we fail to free the original cursor that
we used to look up the XFS_BTNUM_CNT tree and hence leak it.

Reported-by: Chris J Arges <[email protected]>
Signed-off-by: Dave Chinner <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Signed-off-by: Ben Myers <[email protected]>
fs/xfs/xfs_alloc.c

index a996e398692b0d7397cb6ca894d1d13ce02e12d8..9d1aeb7e273492f67e97c3f43108a57000cd7c0f 100644 (file)
@@ -1080,6 +1080,7 @@ restart:
                        goto restart;
                }
 
+               xfs_btree_del_cursor(cnt_cur, XFS_BTREE_NOERROR);
                trace_xfs_alloc_size_neither(args);
                args->agbno = NULLAGBLOCK;
                return 0;