Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit de2ad486 authored by Li RongQing's avatar Li RongQing Committed by Steffen Klassert
Browse files

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: default avatarLi RongQing <roy.qing.li@gmail.com>
Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
parent 586f2eb4
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -700,6 +700,9 @@ static void xfrm_policy_requeue(struct xfrm_policy *old,
	struct xfrm_policy_queue *pq = &old->polq;
	struct xfrm_policy_queue *pq = &old->polq;
	struct sk_buff_head list;
	struct sk_buff_head list;


	if (skb_queue_empty(&pq->hold_queue))
		return;

	__skb_queue_head_init(&list);
	__skb_queue_head_init(&list);


	spin_lock_bh(&pq->hold_queue.lock);
	spin_lock_bh(&pq->hold_queue.lock);
@@ -708,9 +711,6 @@ static void xfrm_policy_requeue(struct xfrm_policy *old,
		xfrm_pol_put(old);
		xfrm_pol_put(old);
	spin_unlock_bh(&pq->hold_queue.lock);
	spin_unlock_bh(&pq->hold_queue.lock);


	if (skb_queue_empty(&list))
		return;

	pq = &new->polq;
	pq = &new->polq;


	spin_lock_bh(&pq->hold_queue.lock);
	spin_lock_bh(&pq->hold_queue.lock);