Commit 997d5c3f authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

sock: sock_dequeue_err_skb() needs hard irq safety

Non NAPI drivers can call skb_tstamp_tx() and then sock_queue_err_skb()
from hard IRQ context.

Therefore, sock_dequeue_err_skb() needs to block hard irq or
corruptions or hangs can happen.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Fixes: 364a9e93 ("sock: deduplicate errqueue dequeue")
Fixes: cb820f8e ("net: Provide a generic socket error queue delivery method for Tx time stamps.")
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 846cd667
...@@ -3621,13 +3621,14 @@ struct sk_buff *sock_dequeue_err_skb(struct sock *sk) ...@@ -3621,13 +3621,14 @@ struct sk_buff *sock_dequeue_err_skb(struct sock *sk)
{ {
struct sk_buff_head *q = &sk->sk_error_queue; struct sk_buff_head *q = &sk->sk_error_queue;
struct sk_buff *skb, *skb_next; struct sk_buff *skb, *skb_next;
unsigned long flags;
int err = 0; int err = 0;
spin_lock_bh(&q->lock); spin_lock_irqsave(&q->lock, flags);
skb = __skb_dequeue(q); skb = __skb_dequeue(q);
if (skb && (skb_next = skb_peek(q))) if (skb && (skb_next = skb_peek(q)))
err = SKB_EXT_ERR(skb_next)->ee.ee_errno; err = SKB_EXT_ERR(skb_next)->ee.ee_errno;
spin_unlock_bh(&q->lock); spin_unlock_irqrestore(&q->lock, flags);
sk->sk_err = err; sk->sk_err = err;
if (err) if (err)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment