From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jiri Pirko Subject: Re: [PATCHv3 net] net: sched: set xt_tgchk_param par.net properly in ipt_init_target Date: Tue, 8 Aug 2017 10:24:03 +0200 Message-ID: <20170808082403.GD1853@nanopsycho> References: <7aa6e3f47ea0feb6f348b4de20fc6503e8c8e25b.1502177125.git.lucien.xin@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: network dev , davem@davemloft.net, Cong Wang To: Xin Long Return-path: Received: from mail-wm0-f66.google.com ([74.125.82.66]:36812 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750776AbdHHIYG (ORCPT ); Tue, 8 Aug 2017 04:24:06 -0400 Received: by mail-wm0-f66.google.com with SMTP id d40so3254534wma.3 for ; Tue, 08 Aug 2017 01:24:06 -0700 (PDT) Content-Disposition: inline In-Reply-To: <7aa6e3f47ea0feb6f348b4de20fc6503e8c8e25b.1502177125.git.lucien.xin@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: Tue, Aug 08, 2017 at 09:25:25AM CEST, lucien.xin@gmail.com wrote: >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 >Signed-off-by: Xin Long Acked-by: Jiri Pirko