diff options
author | Eric Dumazet <edumazet@google.com> | 2015-02-18 05:47:55 -0800 |
---|---|---|
committer | Sasha Levin <sasha.levin@oracle.com> | 2015-03-14 15:37:12 -0400 |
commit | 4946f9d29794e6b5f2efc47eb6ac23b8bf9645f6 (patch) | |
tree | 69bb3a604b4d6eec70ffbb18c43a042909082592 /net | |
parent | 91f3fc9b4df473b8e1824fdd22147aa7c97f3042 (diff) |
sock: sock_dequeue_err_skb() needs hard irq safety
[ Upstream commit 997d5c3f4427f38562cbe207ce05bb25fdcb993b ]
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: Eric Dumazet <edumazet@google.com>
Fixes: 364a9e93243d1 ("sock: deduplicate errqueue dequeue")
Fixes: cb820f8e4b7f7 ("net: Provide a generic socket error queue delivery method for Tx time stamps.")
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/skbuff.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index d7543d0fd744..79589ae84a5d 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -3515,13 +3515,14 @@ struct sk_buff *sock_dequeue_err_skb(struct sock *sk) { struct sk_buff_head *q = &sk->sk_error_queue; struct sk_buff *skb, *skb_next; + unsigned long flags; int err = 0; - spin_lock_bh(&q->lock); + spin_lock_irqsave(&q->lock, flags); skb = __skb_dequeue(q); if (skb && (skb_next = skb_peek(q))) err = SKB_EXT_ERR(skb_next)->ee.ee_errno; - spin_unlock_bh(&q->lock); + spin_unlock_irqrestore(&q->lock, flags); sk->sk_err = err; if (err) |