]> Git Repo - linux.git/commitdiff
ipv6: exthdrs: do not blindly use init_net
authorEric Dumazet <[email protected]>
Wed, 23 Jun 2021 15:27:00 +0000 (08:27 -0700)
committerDavid S. Miller <[email protected]>
Wed, 23 Jun 2021 20:53:38 +0000 (13:53 -0700)
I see no reason why max_dst_opts_cnt and max_hbh_opts_cnt
are fetched from the initial net namespace.

The other sysctls (max_dst_opts_len & max_hbh_opts_len)
are in fact already using the current ns.

Note: it is not clear why ipv6_destopt_rcv() use two ways to
get to the netns :

 1) dev_net(dst->dev)
    Originally used to increment IPSTATS_MIB_INHDRERRORS

 2) dev_net(skb->dev)
     Tom used this variant in his patch.

Maybe this calls to use ipv6_skb_net() instead ?

Fixes: 47d3d7ac656a ("ipv6: Implement limits on Hop-by-Hop and Destination options")
Signed-off-by: Eric Dumazet <[email protected]>
Cc: Tom Herbert <[email protected]>
Cc: Coco Li <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
net/ipv6/exthdrs.c

index 56e479d158b7c069000f77db88f468d9414ff7e5..6f7da8f3e2e5849f917853984c69bf02a0f1e27c 100644 (file)
@@ -306,7 +306,7 @@ fail_and_free:
 #endif
 
        if (ip6_parse_tlv(tlvprocdestopt_lst, skb,
-                         init_net.ipv6.sysctl.max_dst_opts_cnt)) {
+                         net->ipv6.sysctl.max_dst_opts_cnt)) {
                skb->transport_header += extlen;
                opt = IP6CB(skb);
 #if IS_ENABLED(CONFIG_IPV6_MIP6)
@@ -1037,7 +1037,7 @@ fail_and_free:
 
        opt->flags |= IP6SKB_HOPBYHOP;
        if (ip6_parse_tlv(tlvprochopopt_lst, skb,
-                         init_net.ipv6.sysctl.max_hbh_opts_cnt)) {
+                         net->ipv6.sysctl.max_hbh_opts_cnt)) {
                skb->transport_header += extlen;
                opt = IP6CB(skb);
                opt->nhoff = sizeof(struct ipv6hdr);
This page took 0.05814 seconds and 4 git commands to generate.