Skip to contentSkip to conversation

xfs: fix allocbt cursor leak in xfs_alloc_ag_vextent_near

PATCH In review Dave Chinner 2 participants 2 messages Jun 12, 2012 – Jun 15, 2012 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: fix allocbt cursor leak in xfs_alloc_ag_vextent_near

From: Dave Chinner <[email protected]>

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.

---
 fs/xfs/xfs_alloc.c |    1 +
 1 file changed, 1 insertion(+)
fs/xfs/xfs_alloc.c +1 -0
index 229641f..70878aa 100644
@@ -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;
Signature · 6 lines
1.7.10

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Dave Chinner

From: Dave Chinner <[email protected]>

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.

Looks correct for now, but mid-term this function absolutely needs a restructuring with good exit labels and a posisble a split up into multiple helpers.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs