Re: [RFC][PATCH 0/5] do not dereference NULL pools in pools' destroy() functions

From: Andrew Morton
Date: Tue Jun 09 2015 - 17:25:36 EST


On Tue, 9 Jun 2015 21:04:48 +0900 Sergey Senozhatsky <sergey.senozhatsky@xxxxxxxxx> wrote:

> The existing pools' destroy() functions do not allow NULL pool pointers;
> instead, every destructor() caller forced to check if pool is not NULL,
> which:
> a) requires additional attention from developers/reviewers
> b) may lead to a NULL pointer dereferences if (a) didn't work
>
>
> First 3 patches tweak
> - kmem_cache_destroy()
> - mempool_destroy()
> - dma_pool_destroy()
>
> to handle NULL pointers.

Well I like it, even though it's going to cause a zillion little cleanup
patches.

checkpatch already has a "kfree(NULL) is safe and this check is
probably not required" test so I guess Joe will need to get busy ;)

I'll park these patches until after 4.1 is released - it's getting to
that time...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/