On Tue, Oct 10, 2017 at 09:04:39AM -0600, Jens Axboe wrote: > On 10/10/2017 08:53 AM, weiping zhang wrote: > > check pol->cpd_free_fn() instead of pol->cpd_alloc_fn() when free cpd. > > In practice this shouldn't make a difference, since if you have an > alloc_fn, you better also have a free_fn. I'd argue a better > patch would be ensuring that's the case, since the current situation > would at least oops and show you there's an issue, but with the patch > we'll just leak the memory. > > I'll apply it, but would be nice if this was handled a bit more > proactively. > Thanks your comments, I'll add a sanity check in blkcg_policy_register function.