summaryrefslogtreecommitdiff
path: root/net/xfrm
diff options
context:
space:
mode:
authorLi RongQing <roy.qing.li@gmail.com>2015-04-30 12:25:19 +0300
committerSteffen Klassert <steffen.klassert@secunet.com>2015-05-05 10:27:01 +0300
commitde2ad486cb6cfdf3ef79a96a18d78bb1b135c0e0 (patch)
tree79cd7e2cac4c67cefa9cc905b7b5c6ece3607ea4 /net/xfrm
parent586f2eb416f4271444e807b96346df3d30e8dfb5 (diff)
downloadlinux-de2ad486cb6cfdf3ef79a96a18d78bb1b135c0e0.tar.xz
xfrm: move the checking for old xfrm_policy hold_queue to beginning
if hold_queue of old xfrm_policy is NULL, return directly, then not need to run other codes, especially take the spin lock Signed-off-by: Li RongQing <roy.qing.li@gmail.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net/xfrm')
-rw-r--r--net/xfrm/xfrm_policy.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 435bc0dc7630..3d264e5e7409 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -700,6 +700,9 @@ static void xfrm_policy_requeue(struct xfrm_policy *old,
struct xfrm_policy_queue *pq = &old->polq;
struct sk_buff_head list;
+ if (skb_queue_empty(&pq->hold_queue))
+ return;
+
__skb_queue_head_init(&list);
spin_lock_bh(&pq->hold_queue.lock);
@@ -708,9 +711,6 @@ static void xfrm_policy_requeue(struct xfrm_policy *old,
xfrm_pol_put(old);
spin_unlock_bh(&pq->hold_queue.lock);
- if (skb_queue_empty(&list))
- return;
-
pq = &new->polq;
spin_lock_bh(&pq->hold_queue.lock);