From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Steffen Klassert Subject: [PATCH 3.15 02/26] xfrm: Fix refcount imbalance in xfrm_lookup Date: Fri, 8 Aug 2014 14:35:09 -0700 Message-Id: <20140808213413.746931745@linuxfoundation.org> In-Reply-To: <20140808213413.648794968@linuxfoundation.org> References: <20140808213413.648794968@linuxfoundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: 3.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Steffen Klassert [ Upstream commit b7eea4545ea775df957460f58eb56085a8892856 ] xfrm_lookup must return a dst_entry with a refcount for the caller. Git commit 1a1ccc96abb ("xfrm: Remove caching of xfrm_policy_sk_bundles") removed this refcount for the socket policy case accidentally. This patch restores it and sets DST_NOCACHE flag to make sure that the dst_entry is freed when the refcount becomes null. Fixes: 1a1ccc96abb ("xfrm: Remove caching of xfrm_policy_sk_bundles") Signed-off-by: Steffen Klassert Signed-off-by: Greg Kroah-Hartman --- net/xfrm/xfrm_policy.c | 2 ++ 1 file changed, 2 insertions(+) --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -2107,6 +2107,8 @@ struct dst_entry *xfrm_lookup(struct net goto no_transform; } + dst_hold(&xdst->u.dst); + xdst->u.dst.flags |= DST_NOCACHE; route = xdst->route; } }