* [PATCH net] sock: reset sk_err when the error queue is empty
@ 2017-06-02 16:38 Soheil Hassas Yeganeh
2017-06-05 0:02 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Soheil Hassas Yeganeh @ 2017-06-02 16:38 UTC (permalink / raw)
To: davem, netdev
Cc: chrubis, Soheil Hassas Yeganeh, Eric Dumazet, Willem de Bruijn
From: Soheil Hassas Yeganeh <soheil@google.com>
Prior to f5f99309fa74 (sock: do not set sk_err in
sock_dequeue_err_skb), sk_err was reset to the error of
the skb on the head of the error queue.
Applications, most notably ping, are relying on this
behavior to reset sk_err for ICMP packets.
Set sk_err to the ICMP error when there is an ICMP packet
at the head of the error queue.
Fixes: f5f99309fa74 (sock: do not set sk_err in sock_dequeue_err_skb)
Reported-by: Cyril Hrubis <chrubis@suse.cz>
Test-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
---
net/core/skbuff.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 346d3e85dfbc..b1be7c01efe2 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -3754,8 +3754,11 @@ struct sk_buff *sock_dequeue_err_skb(struct sock *sk)
spin_lock_irqsave(&q->lock, flags);
skb = __skb_dequeue(q);
- if (skb && (skb_next = skb_peek(q)))
+ if (skb && (skb_next = skb_peek(q))) {
icmp_next = is_icmp_err_skb(skb_next);
+ if (icmp_next)
+ sk->sk_err = SKB_EXT_ERR(skb_next)->ee.ee_origin;
+ }
spin_unlock_irqrestore(&q->lock, flags);
if (is_icmp_err_skb(skb) && !icmp_next)
--
2.13.0.506.g27d5fe0cd-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH net] sock: reset sk_err when the error queue is empty
2017-06-02 16:38 [PATCH net] sock: reset sk_err when the error queue is empty Soheil Hassas Yeganeh
@ 2017-06-05 0:02 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-06-05 0:02 UTC (permalink / raw)
To: soheil.kdev; +Cc: netdev, chrubis, soheil, edumazet, willemb
From: Soheil Hassas Yeganeh <soheil.kdev@gmail.com>
Date: Fri, 2 Jun 2017 12:38:22 -0400
> From: Soheil Hassas Yeganeh <soheil@google.com>
>
> Prior to f5f99309fa74 (sock: do not set sk_err in
> sock_dequeue_err_skb), sk_err was reset to the error of
> the skb on the head of the error queue.
>
> Applications, most notably ping, are relying on this
> behavior to reset sk_err for ICMP packets.
>
> Set sk_err to the ICMP error when there is an ICMP packet
> at the head of the error queue.
>
> Fixes: f5f99309fa74 (sock: do not set sk_err in sock_dequeue_err_skb)
> Reported-by: Cyril Hrubis <chrubis@suse.cz>
> Test-by: Cyril Hrubis <chrubis@suse.cz>
> Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Willem de Bruijn <willemb@google.com>
Applied and queued up for -stable, thank you.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-06-05 0:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-02 16:38 [PATCH net] sock: reset sk_err when the error queue is empty Soheil Hassas Yeganeh
2017-06-05 0:02 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).