lkml.org 
[lkml]   [2008]   [Jul]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [regression] nf_iterate(), BUG: unable to handle kernel NULL pointer dereference
Pekka Enberg wrote:
> On Thu, 2008-07-24 at 14:49 +0200, Patrick McHardy wrote:
>> Pekka Enberg wrote:
>>> Hmm, why do you think it's related? It looks like elem->hook() is a
>>> NULL pointer but my patch shouldn't make any difference here...
>> No, its already in ipv4_confirm, so its most likely helper->help()
>> thats NULL, which is contained in an extension.
>>
>> The reason why I think its this patch is (quoting from an old
>> email that I never got a response to):
>
> Oh, I'm really sorry about that.

No problem :)

>> ---
>> Your patch introduced a use-after-free and double-free.
>> krealloc() frees the old pointer, but it is still used
>> for the ->move operations, then freed again.
>>
>> To fix this I think we need a __krealloc() that doesn't
>> free the old memory, especially since it must not be
>> freed immediately because it may still be used in a RCU
>> read side (see the last part in the patch attached to
>> this mail (based on a kernel without your patch)).
>
> Agreed. Something like this, perhaps?
>
> [PATCH] netfilter: fix double-free and use-after free
>
> As suggested by Patrick McHardy, introduce a __krealloc() that doesn't
> free the original buffer to fix a double-free and use-after-free bug
> introduced by me in netfilter that uses RCU.
>
> Reported-by: Patrick McHardy <kaber@trash.net>
> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>

Looks good to me, thanks.


\
 
 \ /
  Last update: 2008-07-24 15:35    [W:0.321 / U:0.420 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site