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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 Jan 2019 16:38:34 +0000 (17:38 +0100)
commita2ee6fb9c675125f2f29cc95aae95b4489880f57
tree319421a319b7c7624075da18412933cd067e6525
parentdc6c13d5d5b47c8a1c0570176a3ad5887dc63b00
tipc: compare remote and local protocols in tipc_udp_enable()

[ Upstream commit fb83ed496b9a654f60cd1d58a0e1e79ec5694808 ]

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/tipc/udp_media.c