Skip to content

Commit

Permalink
xfrm: move the checking for old xfrm_policy hold_queue to beginning
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Li RongQing authored and Steffen Klassert committed May 5, 2015
1 parent 586f2eb commit de2ad48
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions net/xfrm/xfrm_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit de2ad48

Please sign in to comment.