kernel: bump 6.1 to 6.1.80
[openwrt/openwrt.git] / target / linux / generic / hack-6.1 / 650-netfilter-add-xt_FLOWOFFLOAD-target.patch
index f753b590e70b9c055973962dda6120d16bb83779..59a5fb4d9104607e6723a5e54cd0339b21b9ef55 100644 (file)
@@ -36,7 +36,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  obj-$(CONFIG_NETFILTER_XT_TARGET_LED) += xt_LED.o
 --- /dev/null
 +++ b/net/netfilter/xt_FLOWOFFLOAD.c
-@@ -0,0 +1,699 @@
+@@ -0,0 +1,702 @@
 +/*
 + * Copyright (C) 2018-2021 Felix Fietkau <nbd@nbd.name>
 + *
@@ -482,9 +482,14 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 +              break;
 +      }
 +
++      if (!dst_hold_safe(this_dst))
++              return -ENOENT;
++
 +      nf_route(xt_net(par), &other_dst, &fl, false, xt_family(par));
-+      if (!other_dst)
++      if (!other_dst) {
++              dst_release(this_dst);
 +              return -ENOENT;
++      }
 +
 +      nf_default_forward_path(route, this_dst, dir, devs);
 +      nf_default_forward_path(route, other_dst, !dir, devs);
@@ -560,8 +565,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 +      if (!flow)
 +              goto err_flow_alloc;
 +
-+      if (flow_offload_route_init(flow, &route) < 0)
-+              goto err_flow_add;
++      flow_offload_route_init(flow, &route);
 +
 +      if (tcph) {
 +              ct->proto.tcp.seen[0].flags |= IP_CT_TCP_FLAG_BE_LIBERAL;
@@ -581,13 +585,12 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 +      xt_flowoffload_check_device(table, devs[0]);
 +      xt_flowoffload_check_device(table, devs[1]);
 +
-+      dst_release(route.tuple[!dir].dst);
-+
 +      return XT_CONTINUE;
 +
 +err_flow_add:
 +      flow_offload_free(flow);
 +err_flow_alloc:
++      dst_release(route.tuple[dir].dst);
 +      dst_release(route.tuple[!dir].dst);
 +err_flow_route:
 +      clear_bit(IPS_OFFLOAD_BIT, &ct->status);
@@ -746,7 +749,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  #include <net/netfilter/nf_flow_table.h>
  #include <net/netfilter/nf_conntrack.h>
  #include <net/netfilter/nf_conntrack_core.h>
-@@ -381,8 +380,7 @@ flow_offload_lookup(struct nf_flowtable
+@@ -374,8 +373,7 @@ flow_offload_lookup(struct nf_flowtable
  }
  EXPORT_SYMBOL_GPL(flow_offload_lookup);
  
@@ -756,7 +759,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
                      void (*iter)(struct nf_flowtable *flowtable,
                                   struct flow_offload *flow, void *data),
                      void *data)
-@@ -443,6 +441,7 @@ static void nf_flow_offload_gc_step(stru
+@@ -436,6 +434,7 @@ static void nf_flow_offload_gc_step(stru
                nf_flow_offload_stats(flow_table, flow);
        }
  }