From: Richard Alpe Date: Thu, 3 Mar 2016 13:20:40 +0000 (+0100) Subject: tipc: add net device to skb before UDP xmit X-Git-Tag: v4.6-rc1~91^2~125 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=9b3009604b8e305c32125530a3cbcc57d88f3bc1;p=linux.git tipc: add net device to skb before UDP xmit Prior to this patch enabling a IPv4 UDP bearer caused a null pointer dereference in iptunnel_xmit_stats(), when it tried to dereference the net device from the skb. To resolve this we now point the skb device to the net device resolved from the routing table. Fixes: 039f50629b7f (ip_tunnel: Move stats update to iptunnel_xmit()) Signed-off-by: Richard Alpe Acked-by: Jon Maloy Reviewed-by: Erik Hugne Signed-off-by: David S. Miller --- diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c index d63a911e7fe2..f22a5bb169c9 100644 --- a/net/tipc/udp_media.c +++ b/net/tipc/udp_media.c @@ -181,6 +181,8 @@ static int tipc_udp_send_msg(struct net *net, struct sk_buff *skb, err = PTR_ERR(rt); goto tx_error; } + + skb->dev = rt->dst.dev; ttl = ip4_dst_hoplimit(&rt->dst); udp_tunnel_xmit_skb(rt, ub->ubsock->sk, skb, src->ipv4.s_addr, dst->ipv4.s_addr, 0, ttl, 0, src->udp_port,