]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
tipc: compare remote and local protocols in tipc_udp_enable()
authorCong Wang <xiyou.wangcong@gmail.com>
Mon, 10 Dec 2018 23:23:30 +0000 (15:23 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 14 Dec 2018 21:28:03 +0000 (13:28 -0800)
When TIPC_NLA_UDP_REMOTE is an IPv6 mcast address but
TIPC_NLA_UDP_LOCAL is an IPv4 address, a NULL-ptr deref is triggered
as the UDP tunnel sock is initialized to IPv4 or IPv6 sock merely
based on the protocol in local address.

We should just error out when the remote address and local address
have different protocols.

Reported-by: syzbot+eb4da3a20fad2e52555d@syzkaller.appspotmail.com
Cc: Ying Xue <ying.xue@windriver.com>
Cc: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/udp_media.c

index 1b1ba1310ea7181f83fafbd97a3f207558d933b7..4d85d71f16e2abcee0f2abd84020f9b471f3e8fa 100644 (file)
@@ -679,6 +679,11 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b,
        if (err)
                goto err;
 
+       if (remote.proto != local.proto) {
+               err = -EINVAL;
+               goto err;
+       }
+
        /* Checking remote ip address */
        rmcast = tipc_udp_is_mcast_addr(&remote);