[lkml]   [2017]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] irq/generic-chip: Fix memory leak of domain->name
On Wed, 27 Sep 2017, Jeffy Chen wrote:

> Free domain->name when IRQ_DOMAIN_NAME_ALLOCATED been set.

I can see that from the patch, but you fail to explain what the problem

It's actually more than just a memory leak. If the domain gets destroyed
then the domain free code would try to free d->name which might be a string
constant .....

> + if (d->flags & IRQ_DOMAIN_NAME_ALLOCATED) {
> + kfree(d->name);
> + }
> d->name = name;

I don't think that this is the proper thing to do. There is no reason why
the domain should have the same name as the irq chip. So we rather should

if (!d->name)
d->name = name;

Along with a proper comment.



 \ /
  Last update: 2017-09-27 15:30    [W:0.067 / U:1.608 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site