tipc: add net device to skb before UDP xmit
authorRichard Alpe <richard.alpe@ericsson.com>
Thu, 3 Mar 2016 13:20:40 +0000 (14:20 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 7 Mar 2016 03:54:56 +0000 (22:54 -0500)
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 <richard.alpe@ericsson.com>
Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Erik Hugne <erik.hugne@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/udp_media.c

index d63a911e7fe29b2f4ef9c1795e47cf5feb006be0..f22a5bb169c944c921fe7769729e4b97eb1cfbc9 100644 (file)
@@ -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,