2010-08-19 04:15:51

by ye janboe

[permalink] [raw]
Subject: Is it possible for addrconf_init_net to kfree no-heap address?

hi, Pavel and David

addrconf_init_net make me a little confused.

if all and dflt are not allocated by kmemdup and sysctl_register
failed, this function will try to kfree dftl which points to
ipv6_devconf_dfl which is not a heap address. AFAIK, kfree will panic
if the address does not belong to slab page.

Is there any special reason for these codes?

many thanks!

--
Janboe Ye


2010-08-23 08:04:29

by Pavel Emelyanov

[permalink] [raw]
Subject: Re: Is it possible for addrconf_init_net to kfree no-heap address?

On 08/19/2010 08:15 AM, ye janboe wrote:
> hi, Pavel and David
>
> addrconf_init_net make me a little confused.
>
> if all and dflt are not allocated by kmemdup and sysctl_register
> failed, this function will try to kfree dftl which points to
> ipv6_devconf_dfl which is not a heap address. AFAIK, kfree will panic
> if the address does not belong to slab page.
>
> Is there any special reason for these codes?

This situation can only occur for the init namespace, i.e. early at host
boot so the sysctl registration will not fail for sure.

On the other hand, since the ipv6 can be built as module this code can be
executed later run-time ...

Can you send a fixing patch?

> many thanks!
>