From: "Timo Teräs" <timo.teras@iki.fi>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH 1/7] xfrm: remove policy lock when accessing policy->walk.dead
Date: Tue, 30 Mar 2010 17:01:47 +0300 [thread overview]
Message-ID: <4BB2044B.5080704@iki.fi> (raw)
In-Reply-To: <4BB1E8B1.4030604@iki.fi>
Timo Teräs wrote:
> Herbert Xu wrote:
>> On Tue, Mar 30, 2010 at 07:55:07AM +0300, Timo Teräs wrote:
>>> Herbert Xu wrote:
>>>> On Mon, Mar 29, 2010 at 05:12:38PM +0300, Timo Teras wrote:
>>>>> @@ -1132,7 +1119,7 @@ int xfrm_sk_policy_insert(struct sock *sk,
>>>>> int dir, struct xfrm_policy *pol)
>>>>> __xfrm_policy_link(pol, XFRM_POLICY_MAX+dir);
>>>>> }
>>>>> if (old_pol)
>>>>> - __xfrm_policy_unlink(old_pol, XFRM_POLICY_MAX+dir);
>>>>> + old_pol = __xfrm_policy_unlink(old_pol, XFRM_POLICY_MAX+dir);
>>>>> write_unlock_bh(&xfrm_policy_lock);
>>>>> if (old_pol) {
>>>> So when can this actually fail?
>>> Considering that the socket reference is received from the
>>> sk->sk_policy,
>>> and the hash bucket we use is "XFRM_POLICY_MAX+dir", it's non-obvious if
>>> it can fail or not.
>>>
>>> It would look like the timer can kill a policy and unlink it, but it
>>> would still be found from sk_policy.
>>
>> Socket policies cannot expire.
>
> Was not aware of that. The above is not needed then.
Since the exported function xfrm_policy_byid() can result in deletion
of socket policy, it's safer to leave this change in. This is can be
even triggered via xfrm_user since it does not check 'dir' for the
policy expired message it handles. Any custom module could do similar
harm.
next prev parent reply other threads:[~2010-03-30 14:01 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-29 14:12 [PATCH 0/7] caching bundles, iteration 2 Timo Teras
2010-03-29 14:12 ` [PATCH 1/7] xfrm: remove policy lock when accessing policy->walk.dead Timo Teras
2010-03-29 14:43 ` Herbert Xu
2010-03-30 4:55 ` Timo Teräs
2010-03-30 11:53 ` Herbert Xu
2010-03-30 12:04 ` Timo Teräs
2010-03-30 12:14 ` Herbert Xu
2010-03-30 12:21 ` Timo Teräs
2010-03-30 12:23 ` Herbert Xu
2010-03-30 12:41 ` Timo Teräs
2010-03-30 12:48 ` Herbert Xu
2010-03-30 13:33 ` Timo Teräs
2010-03-30 14:30 ` Herbert Xu
2010-03-30 14:34 ` Herbert Xu
2010-03-30 14:37 ` Herbert Xu
2010-03-30 14:01 ` Timo Teräs [this message]
2010-03-30 14:29 ` Herbert Xu
2010-03-30 15:36 ` Timo Teräs
2010-03-31 0:43 ` Herbert Xu
2010-03-29 14:12 ` [PATCH 2/7] flow: structurize flow cache Timo Teras
2010-03-30 12:01 ` Herbert Xu
2010-03-30 12:02 ` Timo Teräs
2010-03-30 12:15 ` Herbert Xu
2010-03-29 14:12 ` [PATCH 3/7] flow: allocate hash table for online cpus only Timo Teras
2010-03-30 12:12 ` Herbert Xu
2010-03-31 12:32 ` Rusty Russell
2010-03-31 13:27 ` Timo Teräs
2010-03-29 14:12 ` [PATCH 4/7] flow: delayed deletion of flow cache entries Timo Teras
2010-03-30 12:22 ` Herbert Xu
2010-03-30 12:32 ` Timo Teräs
2010-03-30 12:36 ` Herbert Xu
2010-03-30 12:43 ` Timo Teräs
2010-03-29 14:12 ` [PATCH 5/7] flow: virtualize get and entry deletion methods Timo Teras
2010-03-29 14:12 ` [PATCH 6/7] xfrm: cache bundles instead of policies for outgoing flows Timo Teras
2010-03-29 14:12 ` [PATCH 7/7] xfrm: remove policy garbage collection Timo Teras
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4BB2044B.5080704@iki.fi \
--to=timo.teras@iki.fi \
--cc=herbert@gondor.apana.org.au \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).