From: Pablo Neira Ayuso <pablo@netfilter.org> To: netfilter-devel@vger.kernel.org Cc: davem@davemloft.net, netdev@vger.kernel.org Subject: [PATCH 8/9] netfilter: conntrack: dccp, sctp: handle null timeout argument Date: Thu, 9 Jan 2020 00:17:12 +0100 Message-ID: <20200108231713.100458-9-pablo@netfilter.org> (raw) In-Reply-To: <20200108231713.100458-1-pablo@netfilter.org> From: Florian Westphal <fw@strlen.de> The timeout pointer can be NULL which means we should modify the per-nets timeout instead. All do this, except sctp and dccp which instead give: general protection fault: 0000 [#1] PREEMPT SMP KASAN net/netfilter/nf_conntrack_proto_dccp.c:682 ctnl_timeout_parse_policy+0x150/0x1d0 net/netfilter/nfnetlink_cttimeout.c:67 cttimeout_default_set+0x150/0x1c0 net/netfilter/nfnetlink_cttimeout.c:368 nfnetlink_rcv_msg+0xcf2/0xfb0 net/netfilter/nfnetlink.c:229 netlink_rcv_skb+0x177/0x450 net/netlink/af_netlink.c:2477 Reported-by: syzbot+46a4ad33f345d1dd346e@syzkaller.appspotmail.com Fixes: c779e849608a8 ("netfilter: conntrack: remove get_timeout() indirection") Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> --- net/netfilter/nf_conntrack_proto_dccp.c | 3 +++ net/netfilter/nf_conntrack_proto_sctp.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/net/netfilter/nf_conntrack_proto_dccp.c b/net/netfilter/nf_conntrack_proto_dccp.c index b6b14db3955b..b3f4a334f9d7 100644 --- a/net/netfilter/nf_conntrack_proto_dccp.c +++ b/net/netfilter/nf_conntrack_proto_dccp.c @@ -677,6 +677,9 @@ static int dccp_timeout_nlattr_to_obj(struct nlattr *tb[], unsigned int *timeouts = data; int i; + if (!timeouts) + timeouts = dn->dccp_timeout; + /* set default DCCP timeouts. */ for (i=0; i<CT_DCCP_MAX; i++) timeouts[i] = dn->dccp_timeout[i]; diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c index fce3d93f1541..0399ae8f1188 100644 --- a/net/netfilter/nf_conntrack_proto_sctp.c +++ b/net/netfilter/nf_conntrack_proto_sctp.c @@ -594,6 +594,9 @@ static int sctp_timeout_nlattr_to_obj(struct nlattr *tb[], struct nf_sctp_net *sn = nf_sctp_pernet(net); int i; + if (!timeouts) + timeouts = sn->timeouts; + /* set default SCTP timeouts. */ for (i=0; i<SCTP_CONNTRACK_MAX; i++) timeouts[i] = sn->timeouts[i]; -- 2.11.0
next prev parent reply index Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-01-08 23:17 [PATCH 0/9] Netfilter fixes for net Pablo Neira Ayuso 2020-01-08 23:17 ` [PATCH 1/9] netfilter: arp_tables: init netns pointer in xt_tgchk_param struct Pablo Neira Ayuso 2020-01-08 23:17 ` [PATCH 2/9] netfilter: nft_flow_offload: fix underflow in flowtable reference counter Pablo Neira Ayuso 2020-01-08 23:17 ` [PATCH 3/9] netfilter: nf_flow_table_offload: fix incorrect ethernet dst address Pablo Neira Ayuso 2020-01-08 23:17 ` [PATCH 4/9] netfilter: nf_flow_table_offload: check the status of dst_neigh Pablo Neira Ayuso 2020-01-08 23:17 ` [PATCH 5/9] netfilter: nf_flow_table_offload: fix the nat port mangle Pablo Neira Ayuso 2020-01-08 23:17 ` [PATCH 6/9] netfilter: nf_tables: unbind callbacks from flowtable destroy path Pablo Neira Ayuso 2020-01-08 23:17 ` [PATCH 7/9] netfilter: flowtable: add nf_flowtable_time_stamp Pablo Neira Ayuso 2020-01-08 23:17 ` Pablo Neira Ayuso [this message] 2020-01-08 23:17 ` [PATCH 9/9] netfilter: ipset: avoid null deref when IPSET_ATTR_LINENO is present Pablo Neira Ayuso 2020-01-08 23:22 ` [PATCH 0/9] Netfilter fixes for net David Miller
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200108231713.100458-9-pablo@netfilter.org \ --to=pablo@netfilter.org \ --cc=davem@davemloft.net \ --cc=netdev@vger.kernel.org \ --cc=netfilter-devel@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Netfilter-Devel Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/netfilter-devel/0 netfilter-devel/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 netfilter-devel netfilter-devel/ https://lore.kernel.org/netfilter-devel \ netfilter-devel@vger.kernel.org public-inbox-index netfilter-devel Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.kernel.vger.netfilter-devel AGPL code for this site: git clone https://public-inbox.org/public-inbox.git