Subject: Re: xfrm_state locking regression...

From: Timo Teräs <[email-masked]>
Date: Wed, 03 Sep 2008 08:39:18 +0300

Herbert Xu wrote:
> On Wed, Sep 03, 2008 at 08:07:33AM +0300, Timo Teräs wrote:
>> But then caller of xfrm_state_walk() can be still holding a
>> reference to the entry and dumping of the whole chain fails,
>> because the entry is no longer part of the chain when dumping
>> continues later.
>>
>> The walking coding skips entries which are dead so the
>> entry is only kept temporarily to make a full traversal of
>> the list.
> 
> Ah I see your point now.
> 
> Actually another thing we should do is to postpone the unlinking
> into the GC process.  This doesn't really need to be immediate.

Yes, might be a good idea.

> And here is a patch to fix a couple of changes in user-behaviour.
> 
> ipsec: Restore larval states and socket policies in dump
> 
> The commit commit 4c563f7669c10a12354b72b518c2287ffc6ebfb3 ("[XFRM]:
> Speed up xfrm_policy and xfrm_state walking") inadvertently removed
> larval states and socket policies from netlink dumps.  This patch
> restores them.

Oh, I seemed to have missed that there was multiple places where
the list insertion happens. Would it make sense to make function
for inserting the entries in the lists?

- Timo