2008-06-17 13:57:27

by Patrick McHardy

[permalink] [raw]
Subject: Re: [PATCH] netfilter: use krealloc() in nf_conntrack_extend.c V2

Pekka Enberg wrote:
> Patrick McHardy wrote:
>> Great, thanks for the explanation. Is this patch targeted
>> at 2.6.26 or 2.6.27?
>
> I don't think we will be removing ksize() in 2.6.26 anyway so 2.6.27 is
> fine for this patch. Thanks!

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)).



Attachments:
01.diff (3.23 kB)