Skip to content

Commit

Permalink
xfrm: check for a vaild skb in xfrm_policy_queue_process
Browse files Browse the repository at this point in the history
We might dreference a NULL pointer if the hold_queue is empty,
so add a check to avoid this.

Bug was introduced with git commit a0073fe ("xfrm: Add a state
resolution packet queue")

Signed-off-by: Steffen Klassert <[email protected]>
  • Loading branch information
klassert committed Oct 8, 2013
1 parent e7d8f6c commit 2bb53e2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions net/xfrm/xfrm_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1772,6 +1772,10 @@ static void xfrm_policy_queue_process(unsigned long arg)

spin_lock(&pq->hold_queue.lock);
skb = skb_peek(&pq->hold_queue);
if (!skb) {
spin_unlock(&pq->hold_queue.lock);
goto out;
}
dst = skb_dst(skb);
sk = skb->sk;
xfrm_decode_session(skb, &fl, dst->ops->family);
Expand Down

0 comments on commit 2bb53e2

Please sign in to comment.