netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] udp: fix the proto value passed to ip_protocol_deliver_rcu for the segments
@ 2020-12-07  7:55 Xin Long
  2020-12-07  8:33 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Xin Long @ 2020-12-07  7:55 UTC (permalink / raw)
  To: network dev; +Cc: davem, kuba, pablo, Guillaume Nault

Guillaume noticed that: for segments udp_queue_rcv_one_skb() returns the
proto, and it should pass "ret" unmodified to ip_protocol_deliver_rcu().
Otherwize, with a negtive value passed, it will underflow inet_protos.

This can be reproduced with IPIP FOU:

  # ip fou add port 5555 ipproto 4
  # ethtool -K eth1 rx-gro-list on

Fixes: cf329aa42b66 ("udp: cope with UDP GRO packet misdirection")
Reported-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 net/ipv4/udp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 09f0a23..9eeebd4 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -2173,7 +2173,7 @@ static int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
 		__skb_pull(skb, skb_transport_offset(skb));
 		ret = udp_queue_rcv_one_skb(sk, skb);
 		if (ret > 0)
-			ip_protocol_deliver_rcu(dev_net(skb->dev), skb, -ret);
+			ip_protocol_deliver_rcu(dev_net(skb->dev), skb, ret);
 	}
 	return 0;
 }
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] udp: fix the proto value passed to ip_protocol_deliver_rcu for the segments
  2020-12-07  7:55 [PATCH net] udp: fix the proto value passed to ip_protocol_deliver_rcu for the segments Xin Long
@ 2020-12-07  8:33 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-12-07  8:33 UTC (permalink / raw)
  To: lucien.xin; +Cc: netdev, kuba, pablo, gnault

From: Xin Long <lucien.xin@gmail.com>
Date: Mon,  7 Dec 2020 15:55:40 +0800

> Guillaume noticed that: for segments udp_queue_rcv_one_skb() returns the
> proto, and it should pass "ret" unmodified to ip_protocol_deliver_rcu().
> Otherwize, with a negtive value passed, it will underflow inet_protos.
> 
> This can be reproduced with IPIP FOU:
> 
>   # ip fou add port 5555 ipproto 4
>   # ethtool -K eth1 rx-gro-list on
> 
> Fixes: cf329aa42b66 ("udp: cope with UDP GRO packet misdirection")
> Reported-by: Guillaume Nault <gnault@redhat.com>
> Signed-off-by: Xin Long <lucien.xin@gmail.com>

Applied and queued up for -stable, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-07  8:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-07  7:55 [PATCH net] udp: fix the proto value passed to ip_protocol_deliver_rcu for the segments Xin Long
2020-12-07  8:33 ` 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).