From 961f125412f02c02e6be60251fb193c56fabfe16 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Sun, 7 Oct 2012 20:01:37 -0400 Subject: [PATCH] PR14682: fix _stp_pmap_agg error exit path commit 82523f19 changed the error-exit path of _stp_pmap_agg, but was confused by the multiple (three!) levels of nested loops in effect at the point of failure. While the prior "return;" skipped an overall (newly needed) aggregate-unlock; the current "break;" skipped too little. Switch to a proper simple goto to almost but not quite return;. --- runtime/map.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/runtime/map.c b/runtime/map.c index b0c7d43be..c9cf029e4 100644 --- a/runtime/map.c +++ b/runtime/map.c @@ -887,17 +887,19 @@ static MAP _stp_pmap_agg (PMAP pmap) _stp_add_agg(aptr, ptr); else { if (!_stp_new_agg(agg, ahead, ptr)) { - quit = 1; - agg = NULL; - break; + MAP_UNLOCK(m); + agg = NULL; + goto out; + // NB: break would head out to the for (hash...) + // loop, which behaves badly with an agg==NULL. } } } } MAP_UNLOCK(m); - if (quit) - break; } + + out: #ifndef __KERNEL__ TLS_DATA_CONTAINER_UNLOCK(&pmap->container); #endif -- 2.43.5