summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorCong Wang2018-12-11 00:23:30 +0100
committerGreg Kroah-Hartman2019-01-09 17:38:34 +0100
commita2ee6fb9c675125f2f29cc95aae95b4489880f57 (patch)
tree319421a319b7c7624075da18412933cd067e6525 /net
parenttipc: check tsk->group in tipc_wait_for_cond() (diff)
downloadkernel-qcow2-linux-a2ee6fb9c675125f2f29cc95aae95b4489880f57.tar.gz
kernel-qcow2-linux-a2ee6fb9c675125f2f29cc95aae95b4489880f57.tar.xz
kernel-qcow2-linux-a2ee6fb9c675125f2f29cc95aae95b4489880f57.zip
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>
Diffstat (limited to 'net')
-rw-r--r--net/tipc/udp_media.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c
index 9783101bc4a9..e685af4f5483 100644
--- a/net/tipc/udp_media.c
+++ b/net/tipc/udp_media.c
@@ -680,6 +680,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;
+ }
+
/* Autoconfigure own node identity if needed */
if (!tipc_own_id(net)) {
memcpy(node_id, local.ipv6.in6_u.u6_addr8, 16);