diff mbox series

[v2] net: geneve: modify IP header check in geneve6_xmit_skb and geneve_xmit_skb

Message ID 20210422234945.1190-1-phil@philpotter.co.uk (mailing list archive)
State Accepted
Commit d13f048dd40e8577260cd43faea8ec9b77520197
Delegated to: Netdev Maintainers
Headers show
Series [v2] net: geneve: modify IP header check in geneve6_xmit_skb and geneve_xmit_skb | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers success CCed 5 of 5 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 16 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Phillip Potter April 22, 2021, 11:49 p.m. UTC
Modify the header size check in geneve6_xmit_skb and geneve_xmit_skb
to use pskb_inet_may_pull rather than pskb_network_may_pull. This fixes
two kernel selftest failures introduced by the commit introducing the
checks:
IPv4 over geneve6: PMTU exceptions
IPv4 over geneve6: PMTU exceptions - nexthop objects

It does this by correctly accounting for the fact that IPv4 packets may
transit over geneve IPv6 tunnels (and vice versa), and still fixes the
uninit-value bug fixed by the original commit.

Reported-by: kernel test robot <oliver.sang@intel.com>
Fixes: 6628ddfec758 ("net: geneve: check skb is large enough for IPv4/IPv6 header")
Suggested-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
---

V2:
* Incorporated feedback from Sabrina Dubroca regarding pskb_inet_may_pull
* Added Fixes: tag as requested by Eric Dumazet

---
 drivers/net/geneve.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Sabrina Dubroca April 23, 2021, 1:41 p.m. UTC | #1
2021-04-23, 00:49:45 +0100, Phillip Potter wrote:
> Modify the header size check in geneve6_xmit_skb and geneve_xmit_skb
> to use pskb_inet_may_pull rather than pskb_network_may_pull. This fixes
> two kernel selftest failures introduced by the commit introducing the
> checks:
> IPv4 over geneve6: PMTU exceptions
> IPv4 over geneve6: PMTU exceptions - nexthop objects
> 
> It does this by correctly accounting for the fact that IPv4 packets may
> transit over geneve IPv6 tunnels (and vice versa), and still fixes the
> uninit-value bug fixed by the original commit.
> 
> Reported-by: kernel test robot <oliver.sang@intel.com>
> Fixes: 6628ddfec758 ("net: geneve: check skb is large enough for IPv4/IPv6 header")
> Suggested-by: Sabrina Dubroca <sd@queasysnail.net>
> Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
> ---
> 
> V2:
> * Incorporated feedback from Sabrina Dubroca regarding pskb_inet_may_pull
> * Added Fixes: tag as requested by Eric Dumazet

Thanks Phillip.

Acked-by: Sabrina Dubroca <sd@queasysnail.net>

Jakub/David, it would be great if this could get in 5.12, otherwise
geneve is a bit broken:
https://bugzilla.kernel.org/show_bug.cgi?id=212749
patchwork-bot+netdevbpf@kernel.org April 23, 2021, 8:30 p.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Fri, 23 Apr 2021 00:49:45 +0100 you wrote:
> Modify the header size check in geneve6_xmit_skb and geneve_xmit_skb
> to use pskb_inet_may_pull rather than pskb_network_may_pull. This fixes
> two kernel selftest failures introduced by the commit introducing the
> checks:
> IPv4 over geneve6: PMTU exceptions
> IPv4 over geneve6: PMTU exceptions - nexthop objects
> 
> [...]

Here is the summary with links:
  - [v2] net: geneve: modify IP header check in geneve6_xmit_skb and geneve_xmit_skb
    https://git.kernel.org/netdev/net/c/d13f048dd40e

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
David Miller April 23, 2021, 8:44 p.m. UTC | #3
From: Sabrina Dubroca <sd@queasysnail.net>
Date: Fri, 23 Apr 2021 15:41:17 +0200

> 2021-04-23, 00:49:45 +0100, Phillip Potter wrote:
>> Modify the header size check in geneve6_xmit_skb and geneve_xmit_skb
>> to use pskb_inet_may_pull rather than pskb_network_may_pull. This fixes
>> two kernel selftest failures introduced by the commit introducing the
>> checks:
>> IPv4 over geneve6: PMTU exceptions
>> IPv4 over geneve6: PMTU exceptions - nexthop objects
>> 
>> It does this by correctly accounting for the fact that IPv4 packets may
>> transit over geneve IPv6 tunnels (and vice versa), and still fixes the
>> uninit-value bug fixed by the original commit.
>> 
>> Reported-by: kernel test robot <oliver.sang@intel.com>
>> Fixes: 6628ddfec758 ("net: geneve: check skb is large enough for IPv4/IPv6 header")
>> Suggested-by: Sabrina Dubroca <sd@queasysnail.net>
>> Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
>> ---
>> 
>> V2:
>> * Incorporated feedback from Sabrina Dubroca regarding pskb_inet_may_pull
>> * Added Fixes: tag as requested by Eric Dumazet
> 
> Thanks Phillip.
> 
> Acked-by: Sabrina Dubroca <sd@queasysnail.net>
> 
> Jakub/David, it would be great if this could get in 5.12, otherwise
> geneve is a bit broken:
> https://bugzilla.kernel.org/show_bug.cgi?id=212749

I don't think we will submit another pull req for networking, but thatys
ok it'll end up in stable eventually.

Thanks.
diff mbox series

Patch

diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index 42f31c681846..61cd3dd4deab 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -891,7 +891,7 @@  static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev,
 	__be16 sport;
 	int err;
 
-	if (!pskb_network_may_pull(skb, sizeof(struct iphdr)))
+	if (!pskb_inet_may_pull(skb))
 		return -EINVAL;
 
 	sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);
@@ -988,7 +988,7 @@  static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
 	__be16 sport;
 	int err;
 
-	if (!pskb_network_may_pull(skb, sizeof(struct ipv6hdr)))
+	if (!pskb_inet_may_pull(skb))
 		return -EINVAL;
 
 	sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);