summaryrefslogtreecommitdiffstats
path: root/lib/stackdepot.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/stackdepot.c')
-rw-r--r--lib/stackdepot.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/stackdepot.c b/lib/stackdepot.c
index a38661beab97..68c1ac9aa916 100644
--- a/lib/stackdepot.c
+++ b/lib/stackdepot.c
@@ -85,6 +85,8 @@ static unsigned int stack_hash_mask;
/* Array of memory regions that store stack traces. */
static void *stack_pools[DEPOT_MAX_POOLS];
+/* Newly allocated pool that is not yet added to stack_pools. */
+static void *new_pool;
/* Currently used pool in stack_pools. */
static int pool_index;
/* Offset to the unused space in the currently used pool. */
@@ -241,7 +243,7 @@ static void depot_keep_new_pool(void **prealloc)
* as long as we do not exceed the maximum number of pools.
*/
if (pool_index + 1 < DEPOT_MAX_POOLS) {
- stack_pools[pool_index + 1] = *prealloc;
+ new_pool = *prealloc;
*prealloc = NULL;
}
@@ -272,6 +274,8 @@ static bool depot_update_pools(size_t required_size, void **prealloc)
* stack_depot_fetch().
*/
WRITE_ONCE(pool_index, pool_index + 1);
+ stack_pools[pool_index] = new_pool;
+ new_pool = NULL;
pool_offset = 0;
/*