Re: Possible memory leaks in proc_sysctl.c

From: Eric W. Biederman
Date: Wed Apr 18 2012 - 09:18:13 EST


Catalin Marinas <catalin.marinas@xxxxxxx> writes:

> Hi Eric,
>
> Following your commit f728019bb (sysctl: register only tables of sysctl
> files), I get several kmemleak reports. They all seem to be header
> allocations with kzalloc() in __register_sysctl_table() and
> __register_sysctl_paths(). The patch isn't simple to quickly figure out
> what may be wrong.

Due to a change in the data structure places where we register the
sysctl permanently and ignore the result from the register_sysctl_...
family of functions now report this leak.

majianpeng has done a good of getting kmemleak_not_leak annotations into
the net tree, and I have one of his patches pending to put into my
sysctl tree (see below).

I don't know if the issue is serious enough to warrant putting the
changes into 3.4 but the patches are trivial.

The pending patch for kernel/sysctl.c

Eric