Commit 985f7337 authored by Willem de Bruijn's avatar Willem de Bruijn Committed by Jakub Kicinski

sock: set sk_err to ee_errno on dequeue from errq

When setting sk_err, set it to ee_errno, not ee_origin.

Commit f5f99309 ("sock: do not set sk_err in
sock_dequeue_err_skb") disabled updating sk_err on errq dequeue,
which is correct for most error types (origins):

  -       sk->sk_err = err;

Commit 38b25793 ("sock: reset sk_err when the error queue is
empty") reenabled the behavior for IMCP origins, which do require it:

  +       if (icmp_next)
  +               sk->sk_err = SKB_EXT_ERR(skb_next)->ee.ee_origin;

But read from ee_errno.

Fixes: 38b25793 ("sock: reset sk_err when the error queue is empty")
Reported-by: default avatarAyush Ranjan <ayushranjan@google.com>
Signed-off-by: default avatarWillem de Bruijn <willemb@google.com>
Acked-by: default avatarSoheil Hassas Yeganeh <soheil@google.com>
Link: https://lore.kernel.org/r/20201126151220.2819322-1-willemdebruijn.kernel@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent d3ab7885
...@@ -4549,7 +4549,7 @@ struct sk_buff *sock_dequeue_err_skb(struct sock *sk) ...@@ -4549,7 +4549,7 @@ struct sk_buff *sock_dequeue_err_skb(struct sock *sk)
if (skb && (skb_next = skb_peek(q))) { if (skb && (skb_next = skb_peek(q))) {
icmp_next = is_icmp_err_skb(skb_next); icmp_next = is_icmp_err_skb(skb_next);
if (icmp_next) if (icmp_next)
sk->sk_err = SKB_EXT_ERR(skb_next)->ee.ee_origin; sk->sk_err = SKB_EXT_ERR(skb_next)->ee.ee_errno;
} }
spin_unlock_irqrestore(&q->lock, flags); spin_unlock_irqrestore(&q->lock, flags);
......
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