From: Steffen Klassert Date: Tue, 15 Mar 2011 21:12:49 +0000 (+0000) Subject: xfrm: Refcount destination entry on xfrm_lookup X-Git-Tag: v2.6.39-rc1~468^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fbd5060875d25f7764fd1c3d35b83a8ed1d88d7b;p=platform%2Fkernel%2Flinux-exynos.git xfrm: Refcount destination entry on xfrm_lookup 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 Acked-by: Timo Teräs Signed-off-by: David S. Miller --- 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;