Re: genetlink: prevent memory leak in netlbl_unlabel_defconf

From: Paul Moore
Date: Fri Sep 27 2019 - 10:49:09 EST


On Fri, Sep 27, 2019 at 9:15 AM Markus Elfring <Markus.Elfring@xxxxxx> wrote:
>
> > > In netlbl_unlabel_defconf if netlbl_domhsh_add_default fails the
> > > allocated entry should be released.
> â
> > That said, netlbl_unlabel_defconf() *should* clean up here just on
> > principal if nothing else.
>
> How do you think about to add the tag âFixesâ then?

>From what I've seen the "Fixes" tag is typically used by people who
are backporting patches, e.g. the -stable folks, to help decide what
they need to backport. As I mentioned in my previous email this
missing free doesn't actually manifest itself as a practical leak on
any of the existing kernels so there isn't a need to backport this
patch. For that reason I would probably skip the "Fixes" metadata
here, but I don't feel strongly enough about it to object if others
want it. FWIW, I play things very conservatively when talking about
backporting patches to stable kernels; if it doesn't fix a serious
user-visible bug it shouldn't be backported IMHO.

This patch is more of a conceptual fix than a practical fix. Not that
there is anything wrong with this patch, I just think it isn't as
critical as most people would think from reading "memory leak" in the
subject line. Yes, there is a memory leak, but the kernel panics soon
after so it's a bit moot. Further, even if the panic was somehow
skipped (?) the memory leak only happens once during boot; the failed
initialization is undoubtedly going to be far more damaging to the
system than a few lost bytes of memory.

--
paul moore
www.paul-moore.com