]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: sched: set xt_tgchk_param par.net properly in ipt_init_target
authorXin Long <lucien.xin@gmail.com>
Tue, 8 Aug 2017 07:25:25 +0000 (15:25 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 13 Aug 2017 02:34:27 +0000 (19:34 -0700)
commit882cce21abed09efd6eb040f52d7e09dd01c2ad1
treea07df3e78225641fd8398d5c6bce68c84f6f8245
parent7be680f71d7d9338beaf00fd01806d751932c68a
net: sched: set xt_tgchk_param par.net properly in ipt_init_target

[ Upstream commit ec0acb09313074ba1a4976945791d9c6815f39fb ]

Now xt_tgchk_param par in ipt_init_target is a local varibale,
par.net is not initialized there. Later when xt_check_target
calls target's checkentry in which it may access par.net, it
would cause kernel panic.

Jaroslav found this panic when running:

  # ip link add TestIface type dummy
  # tc qd add dev TestIface ingress handle ffff:
  # tc filter add dev TestIface parent ffff: u32 match u32 0 0 \
    action xt -j CONNMARK --set-mark 4

This patch is to pass net param into ipt_init_target and set
par.net with it properly in there.

v1->v2:
  As Wang Cong pointed, I missed ipt_net_id != xt_net_id, so fix
  it by also passing net_id to __tcf_ipt_init.
v2->v3:
  Missed the fixes tag, so add it.

Fixes: ecb2421b5ddf ("netfilter: add and use nf_ct_netns_get/put")
Reported-by: Jaroslav Aster <jaster@redhat.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/sched/act_ipt.c