Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp21941360ybl; Mon, 6 Jan 2020 14:35:22 -0800 (PST) X-Google-Smtp-Source: APXvYqyM6Pu45ZcWzevT6i554I3Na50hRrzI3c9ewVGgkNBjq7egbo0uHbAvMybdhcmq96qJCe8B X-Received: by 2002:a05:6808:9ba:: with SMTP id e26mr6671831oig.81.1578350122247; Mon, 06 Jan 2020 14:35:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578350122; cv=none; d=google.com; s=arc-20160816; b=qH8I3ORJ3JFxrrXJH7W01/2lmCVLQJ6+iCsf/Sks1XLF/OqtXr0pKR4MNVXy/OefsG eZVknSVBJjV+2xk34S9YSrOjagJ7GCw+cYXQuNKJj28J8SJzKKXksKZBAZdGc5j+BAUX 149HxiRmRtrFHinPKjOg8vnI0j01XXdlrxXD2Xw37dZNkCDqiEndr1RJYoiTJdsBH2Ws 7c81YrgO7ofGDR/P+Ekb8TisI1XkqTJ4yUImgFUIxG9xdXi/4zuLQkazuEKITv/uLKIs PBjkmeJC8UyxcbO8hhebF4H4pDdLAE0OHF0JWm1Sn54ZAUz72LhyP7i/F4OQykChOlEW d6/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=rpWZPbmXdckYSSWOGjTZXQusBfHRug2zwuoDN+QM1TA=; b=ADfj0NJb4N2FvkPYe7HktPGP7jy68V3viGAaJdNmN/qWweH2pWtSLR1SqtZqCEYlrC IOn2B1V4LInM5yg2J2QkuVV+X9V5D//shGhpy8fdcdMy4PemtW8fGEYH1IO2mWiP7fEV tTTxRt5Y6yNRXb3TISgF0DJepiPEYRCOGWD6zBclbJP593oQFN4HPOk3R8lFayPvGayj 0GqCGgJmLIZGGu5cVRE6CtjVhHwBooRW/uf3eFD+lTslO88R73XvJt8jxQx+xsHyei1B Vez2ewxfVn6WSVRz6NhFvBdDIXGT71SKoFGwU0o7EIRrKTBBGfZ9UwX6GLUZHO0luyn3 vUvw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z4si31309479oix.48.2020.01.06.14.35.09; Mon, 06 Jan 2020 14:35:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727108AbgAFWe2 (ORCPT + 99 others); Mon, 6 Jan 2020 17:34:28 -0500 Received: from Chamillionaire.breakpoint.cc ([193.142.43.52]:38382 "EHLO Chamillionaire.breakpoint.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726721AbgAFWe2 (ORCPT ); Mon, 6 Jan 2020 17:34:28 -0500 Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1ioax7-0007Wf-FD; Mon, 06 Jan 2020 23:34:25 +0100 From: Florian Westphal To: Cc: syzkaller-bugs@googlegroups.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Florian Westphal , syzbot+46a4ad33f345d1dd346e@syzkaller.appspotmail.com Subject: [PATCH nf] netfilter: conntrack: dccp, sctp: handle null timeout argument Date: Mon, 6 Jan 2020 23:34:17 +0100 Message-Id: <20200106223417.18279-1-fw@strlen.de> X-Mailer: git-send-email 2.24.1 In-Reply-To: <0000000000009cd5e0059b7eb836@google.com> References: <0000000000009cd5e0059b7eb836@google.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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; idccp_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; itimeouts[i]; -- 2.24.1