kernel: net_sched: fix a NULL pointer deref in ipt action
authorCong Wang <xiyou.wangcong@gmail.com>
Sun, 25 Aug 2019 12:35:06 +0000 (05:35 -0700)
committerRISCi_ATOM <bob@bobcall.me>
Fri, 13 Sep 2019 20:24:15 +0000 (16:24 -0400)
commitcdcbcd5b5f5cdbec430c0a442cad0eadd8781ba0
treec5e1e376a5732cd768a9bac9da6b61a3fa3fbd44
parent20f15802dfce185e1442fd654e346c03448973a7
kernel: net_sched: fix a NULL pointer deref in ipt action

The net pointer in struct xt_tgdtor_param is not explicitly
initialized therefore is still NULL when dereferencing it.
So we have to find a way to pass the correct net pointer to
ipt_destroy_target().

The best way I find is just saving the net pointer inside the per
netns struct tcf_idrinfo, which could make this patch smaller.

Fixes: 0c66dc1ea3f0 ("netfilter: conntrack: register hooks in netns when needed by ruleset")
Reported-and-tested-by: Tony Ambardar <itugrok@xxxxxxxxx>
Cc: Jamal Hadi Salim <jhs@xxxxxxxxxxxx>
Cc: Jiri Pirko <jiri@xxxxxxxxxxx>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
[Backport for kernel v4.19 and v4.14]
Link: https://bugzilla.kernel.org/show_bug.cgi?id=204681]
Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
(cherry picked from commit 7735cce0c5c306bd9eea20ca2805e4a492c02be9)
target/linux/generic/backport-4.14/380-v5.3-net-sched-Introduce-act_ctinfo-action.patch
target/linux/generic/backport-4.14/390-v5.3-net-sched-fix-action-ipt-crash.patch [new file with mode: 0644]