diff options
author | Steffen Klassert <steffen.klassert@secunet.com> | 2013-10-08 04:49:51 -0400 |
---|---|---|
committer | Steffen Klassert <steffen.klassert@secunet.com> | 2013-10-08 04:49:51 -0400 |
commit | 2bb53e2557964c2c5368a0392cf3b3b63a288cd0 (patch) | |
tree | a62a0dd7f1cbfe4dab7826e0769d9a0a8fde81c3 /net/xfrm | |
parent | e7d8f6cb2f8735693396872f4608bbe305e8baee (diff) |
xfrm: check for a vaild skb in xfrm_policy_queue_process
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 a0073fe18 ("xfrm: Add a state
resolution packet queue")
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net/xfrm')
-rw-r--r-- | net/xfrm/xfrm_policy.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 5f9be976770e..76e1873811d4 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -1772,6 +1772,10 @@ static void xfrm_policy_queue_process(unsigned long arg) | |||
1772 | 1772 | ||
1773 | spin_lock(&pq->hold_queue.lock); | 1773 | spin_lock(&pq->hold_queue.lock); |
1774 | skb = skb_peek(&pq->hold_queue); | 1774 | skb = skb_peek(&pq->hold_queue); |
1775 | if (!skb) { | ||
1776 | spin_unlock(&pq->hold_queue.lock); | ||
1777 | goto out; | ||
1778 | } | ||
1775 | dst = skb_dst(skb); | 1779 | dst = skb_dst(skb); |
1776 | sk = skb->sk; | 1780 | sk = skb->sk; |
1777 | xfrm_decode_session(skb, &fl, dst->ops->family); | 1781 | xfrm_decode_session(skb, &fl, dst->ops->family); |