* [PATCH] xfrm: Refcount destination entry on xfrm_lookup
@ 2011-03-16 7:12 Steffen Klassert
2011-03-16 8:03 ` Timo Teräs
0 siblings, 1 reply; 3+ messages in thread
From: Steffen Klassert @ 2011-03-16 7:12 UTC (permalink / raw)
To: David Miller, Timo Teräs; +Cc: netdev
We return a destination entry without refcount if a socket
policy is found in xfrm_lookup. This triggers a warning on
a negative refcount when freeeing this dst entry. So take
a refcount in this case to fix it.
This refcount was forgotten when xfrm changed to cache bundles
instead of policies for outgoing flows.
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
net/xfrm/xfrm_policy.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 027e3c6..15792d8 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1804,6 +1804,8 @@ restart:
goto no_transform;
}
+ dst_hold(&xdst->u.dst);
+
spin_lock_bh(&xfrm_policy_sk_bundle_lock);
xdst->u.dst.next = xfrm_policy_sk_bundles;
xfrm_policy_sk_bundles = &xdst->u.dst;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] xfrm: Refcount destination entry on xfrm_lookup
2011-03-16 7:12 [PATCH] xfrm: Refcount destination entry on xfrm_lookup Steffen Klassert
@ 2011-03-16 8:03 ` Timo Teräs
2011-03-16 19:56 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Timo Teräs @ 2011-03-16 8:03 UTC (permalink / raw)
To: Steffen Klassert; +Cc: David Miller, netdev
On 03/16/2011 09:12 AM, Steffen Klassert wrote:
> We return a destination entry without refcount if a socket
> policy is found in xfrm_lookup. This triggers a warning on
> a negative refcount when freeeing this dst entry. So take
> a refcount in this case to fix it.
>
> This refcount was forgotten when xfrm changed to cache bundles
> instead of policies for outgoing flows.
>
> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Acked-by: Timo Teräs <timo.teras@iki.fi>
Ok. This is one of the corner cases I did not test: having socket policy
something else than no action. I just didn't have the application ready
for it. Sorry about the bug. And good catch Steffen.
> ---
> net/xfrm/xfrm_policy.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
> index 027e3c6..15792d8 100644
> --- a/net/xfrm/xfrm_policy.c
> +++ b/net/xfrm/xfrm_policy.c
> @@ -1804,6 +1804,8 @@ restart:
> goto no_transform;
> }
>
> + dst_hold(&xdst->u.dst);
> +
> spin_lock_bh(&xfrm_policy_sk_bundle_lock);
> xdst->u.dst.next = xfrm_policy_sk_bundles;
> xfrm_policy_sk_bundles = &xdst->u.dst;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] xfrm: Refcount destination entry on xfrm_lookup
2011-03-16 8:03 ` Timo Teräs
@ 2011-03-16 19:56 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2011-03-16 19:56 UTC (permalink / raw)
To: timo.teras; +Cc: steffen.klassert, netdev
From: Timo Teräs <timo.teras@iki.fi>
Date: Wed, 16 Mar 2011 10:03:23 +0200
> On 03/16/2011 09:12 AM, Steffen Klassert wrote:
>> We return a destination entry without refcount if a socket
>> policy is found in xfrm_lookup. This triggers a warning on
>> a negative refcount when freeeing this dst entry. So take
>> a refcount in this case to fix it.
>>
>> This refcount was forgotten when xfrm changed to cache bundles
>> instead of policies for outgoing flows.
>>
>> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
>
> Acked-by: Timo Teräs <timo.teras@iki.fi>
>
> Ok. This is one of the corner cases I did not test: having socket policy
> something else than no action. I just didn't have the application ready
> for it. Sorry about the bug. And good catch Steffen.
Applied and queued up for -stable, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-03-16 19:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-16 7:12 [PATCH] xfrm: Refcount destination entry on xfrm_lookup Steffen Klassert
2011-03-16 8:03 ` Timo Teräs
2011-03-16 19:56 ` David Miller
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).