]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
netfilter: nft_flow_offload: IPCB is only valid for ipv4 family
authorFlorian Westphal <fw@strlen.de>
Tue, 21 May 2019 11:24:33 +0000 (13:24 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Jul 2019 07:52:21 +0000 (09:52 +0200)
commit 69aeb538587e087bfc81dd1f465eab3558ff3158 upstream.

Guard this with a check vs. ipv4, IPCB isn't valid in ipv6 case.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/netfilter/nft_flow_offload.c

index e140d8af30b31174e448fb7e53b8f94a2a0abeb8..ae57efb31d83fc5d016507e78af2067d2999488b 100644 (file)
@@ -48,15 +48,20 @@ static int nft_flow_route(const struct nft_pktinfo *pkt,
        return 0;
 }
 
-static bool nft_flow_offload_skip(struct sk_buff *skb)
+static bool nft_flow_offload_skip(struct sk_buff *skb, int family)
 {
-       struct ip_options *opt  = &(IPCB(skb)->opt);
-
-       if (unlikely(opt->optlen))
-               return true;
        if (skb_sec_path(skb))
                return true;
 
+       if (family == NFPROTO_IPV4) {
+               const struct ip_options *opt;
+
+               opt = &(IPCB(skb)->opt);
+
+               if (unlikely(opt->optlen))
+                       return true;
+       }
+
        return false;
 }
 
@@ -74,7 +79,7 @@ static void nft_flow_offload_eval(const struct nft_expr *expr,
        struct nf_conn *ct;
        int ret;
 
-       if (nft_flow_offload_skip(pkt->skb))
+       if (nft_flow_offload_skip(pkt->skb, nft_pf(pkt)))
                goto out;
 
        ct = nf_ct_get(pkt->skb, &ctinfo);