* [PATCH net] sock: sock_dequeue_err_skb() needs hard irq safety
@ 2015-02-18 13:47 Eric Dumazet
2015-02-20 20:53 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2015-02-18 13:47 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Willem de Bruijn
From: Eric Dumazet <edumazet@google.com>
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.")
---
net/core/skbuff.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 88c613eab142..f80507823531 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -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 *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)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] sock: sock_dequeue_err_skb() needs hard irq safety
2015-02-18 13:47 [PATCH net] sock: sock_dequeue_err_skb() needs hard irq safety Eric Dumazet
@ 2015-02-20 20:53 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-02-20 20:53 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev, willemb
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 18 Feb 2015 05:47:55 -0800
> From: Eric Dumazet <edumazet@google.com>
>
> 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.")
Applied and queued up for -stable, thanks Eric.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-02-20 20:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-18 13:47 [PATCH net] sock: sock_dequeue_err_skb() needs hard irq safety Eric Dumazet
2015-02-20 20:53 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.