summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorSoheil Hassas Yeganeh <soheil@google.com>2017-06-02 12:38:22 -0400
committerDavid S. Miller <davem@davemloft.net>2017-06-04 20:01:53 -0400
commit38b257938ac6655d0d6333743303231b9c465ec1 (patch)
treeddd35c10ba411c39ac7cf0f39857bd00b4b62ad2 /net
parenta7c0b8bee212e22725196fda8389bff9ade3ac68 (diff)
downloadop-kernel-dev-38b257938ac6655d0d6333743303231b9c465ec1.zip
op-kernel-dev-38b257938ac6655d0d6333743303231b9c465ec1.tar.gz
sock: reset sk_err when the error queue is empty
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> Tested-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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/skbuff.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 346d3e8..b1be7c0 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)
OpenPOWER on IntegriCloud