lkml.org 
[lkml]   [2008]   [Jul]   [26]   [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
Linus Torvalds wrote:
>
> On Thu, 24 Jul 2008, Patrick McHardy wrote:
>> 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)).
>
> Hmm. Don't you need to fix some of the ordering of the initialization too?
>
> If there are possible readers that happen in parallel with changing this
> thing, don't you need to protect the update of "ext->len" against the
> actual changes? And the readers should probably have a read barrier
> between checking "len" and actually looking at the values?

Extensions can only be added while the conntrack is "unconfirmed",
meaning its not in the hash tables yet and the reference is exclusive.
The reason why we need RCU at all is that the extension areas
might already visible and contained in RCU protected lists.

> Finally, why do
> the "ct->ext" dereference thing, when we know it has to be equal to "new"?

Thats a relict of the old code, which allocated "new" conditionally.
I've taken that part from your patch without the smb_wmb(), which
shouldn't be necessary.


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