From: Steffen Klassert <steffen.klassert@secunet.com>
To: Xianpeng Zhao <673321875@qq.com>
Cc: netdev <netdev@vger.kernel.org>, alan <alan@lxorguk.ukuu.org.uk>
Subject: Re: Fw:[Bug 70471] xfrm policy node will double unlink.
Date: Fri, 21 Feb 2014 08:35:30 +0100 [thread overview]
Message-ID: <20140221073530.GH32371@secunet.com> (raw)
In-Reply-To: <tencent_0260B87B11A1005909F5BB41@qq.com>
On Thu, Feb 20, 2014 at 10:01:19AM +0800, Xianpeng Zhao wrote:
> Sorry, I misunderstood your means in last mail.
> I get your patch now. Later I will use your patch.
>
The patch below is what I plan to commit to the ipsec tree,
please test it. Thanks!
Subject: [PATCH] xfrm: Fix unlink race when policies are deleted.
When a policy is unlinked from the lists in thread context,
the xfrm timer can fire before we can mark this policy as dead.
So reinitialize the bydst hlist, then hlist_unhashed() will
notice that this policy is not linked and will avoid a
doulble unlink of that policy.
Reported-by: Xianpeng Zhao <673321875@qq.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
net/xfrm/xfrm_policy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 4b98b25..1d5c7bf 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1158,7 +1158,7 @@ static struct xfrm_policy *__xfrm_policy_unlink(struct xfrm_policy *pol,
if (hlist_unhashed(&pol->bydst))
return NULL;
- hlist_del(&pol->bydst);
+ hlist_del_init(&pol->bydst);
hlist_del(&pol->byidx);
list_del(&pol->walk.all);
net->xfrm.policy_count[dir]--;
--
1.7.9.5
prev parent reply other threads:[~2014-02-21 7:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-18 2:55 Fw:[Bug 70471] xfrm policy node will double unlink Xianpeng Zhao
2014-02-18 8:37 ` Steffen Klassert
2014-02-19 2:07 ` Xianpeng Zhao
2014-02-19 11:43 ` Steffen Klassert
2014-02-20 2:01 ` Xianpeng Zhao
2014-02-21 7:35 ` Steffen Klassert [this message]
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=20140221073530.GH32371@secunet.com \
--to=steffen.klassert@secunet.com \
--cc=673321875@qq.com \
--cc=alan@lxorguk.ukuu.org.uk \
--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).