]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
netfilter: conntrack: dccp, sctp: handle null timeout argument
authorFlorian Westphal <fw@strlen.de>
Mon, 6 Jan 2020 22:34:17 +0000 (23:34 +0100)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 14 Feb 2020 05:29:37 +0000 (00:29 -0500)
BugLink: https://bugs.launchpad.net/bugs/1861934
commit 1d9a7acd3d1e74c2d150d8934f7f55bed6d70858 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
net/netfilter/nf_conntrack_proto_dccp.c
net/netfilter/nf_conntrack_proto_sctp.c

index 2108892a1998a453f0415ef9943c68a54ea2038c..4ad7496a60b26aaa701d201fab5db9971d8e3e50 100644 (file)
@@ -712,6 +712,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];
index 80faf04ddf155254768dfed7f15c4bab64514ad7..f6706c23f202eb0f6fe062b2c6efd3b8c7a1ae0e 100644 (file)
@@ -628,6 +628,9 @@ static int sctp_timeout_nlattr_to_obj(struct nlattr *tb[],
        struct nf_sctp_net *sn = 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];