kernel: act_ctinfo: backport memory leak fix
[openwrt/staging/dedeckeh.git] / target / linux / generic / backport-4.14 / 380-v5.3-net-sched-Introduce-act_ctinfo-action.patch
index 64f6620b2ab7c9d78f56de97f03894c07d0b4707..617112186e8739a91589e33a5587810817eab739 100644 (file)
@@ -1,4 +1,4 @@
-From 147b0d133b53635db0cc572294840652c9c7b662 Mon Sep 17 00:00:00 2001
+From 85fc2a6db8279c5e43c38ef7e715d14e57287997 Mon Sep 17 00:00:00 2001
 From: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
 Date: Wed, 13 Mar 2019 20:54:49 +0000
 Subject: [PATCH] net: sched: Backport Introduce act_ctinfo action
@@ -112,8 +112,8 @@ Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
  include/uapi/linux/tc_act/tc_ctinfo.h |  29 ++
  net/sched/Kconfig                     |  13 +
  net/sched/Makefile                    |   1 +
- net/sched/act_ctinfo.c                | 394 ++++++++++++++++++++++++++
- 6 files changed, 472 insertions(+), 1 deletion(-)
+ net/sched/act_ctinfo.c                | 404 ++++++++++++++++++++++++++
+ 6 files changed, 482 insertions(+), 1 deletion(-)
  create mode 100644 include/net/tc_act/tc_ctinfo.h
  create mode 100644 include/uapi/linux/tc_act/tc_ctinfo.h
  create mode 100644 net/sched/act_ctinfo.c
@@ -232,7 +232,7 @@ Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
  obj-$(CONFIG_NET_IFE_SKBMARK) += act_meta_mark.o
 --- /dev/null
 +++ b/net/sched/act_ctinfo.c
-@@ -0,0 +1,394 @@
+@@ -0,0 +1,404 @@
 +// SPDX-License-Identifier: GPL-2.0+
 +/* net/sched/act_ctinfo.c  netfilter ctinfo connmark actions
 + *
@@ -579,6 +579,15 @@ Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
 +      return tcf_idr_search(tn, a, index);
 +}
 +
++{
++      struct tcf_ctinfo *ci = to_ctinfo(a);
++      struct tcf_ctinfo_params *cp;
++
++      cp = rcu_dereference_protected(ci->params, 1);
++      if (cp)
++              kfree_rcu(cp, rcu);
++}
++
 +static struct tc_action_ops act_ctinfo_ops = {
 +      .kind   = "ctinfo",
 +      .type   = TCA_ID_CTINFO,
@@ -586,6 +595,7 @@ Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
 +      .act    = tcf_ctinfo_act,
 +      .dump   = tcf_ctinfo_dump,
 +      .init   = tcf_ctinfo_init,
++      .cleanup= tcf_ctinfo_cleanup,
 +      .walk   = tcf_ctinfo_walker,
 +      .lookup = tcf_ctinfo_search,
 +      .size   = sizeof(struct tcf_ctinfo),