Re: [PATCH] lib/stackdepot: fix global out-of-bounds in stack_slabs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2020/02/03 19:29, glider@xxxxxxxxxx wrote:
> --- a/lib/stackdepot.c
> +++ b/lib/stackdepot.c
> @@ -84,7 +84,9 @@ static bool init_stack_slab(void **prealloc)
>  	if (stack_slabs[depot_index] == NULL) {
>  		stack_slabs[depot_index] = *prealloc;
>  	} else {
> -		stack_slabs[depot_index + 1] = *prealloc;
> +		/* If this is the last depot slab, do not touch the next one. */
> +		if (depot_index + 1 < STACK_ALLOC_MAX_SLABS)
> +			stack_slabs[depot_index + 1] = *prealloc;

What prevents memory leak (caused by "*prealloc = NULL;")
when we hit depot_index + 1 >= STACK_ALLOC_MAX_SLABS condition?

>  		/*
>  		 * This smp_store_release pairs with smp_load_acquire() from
>  		 * |next_slab_inited| above and in stack_depot_save().
> 




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux