Expand headroom further for IPv6 in order to be able to fit the larger header. Prior to this patch this caused a skb under panic for certain tipc packets, for example retransmissions.
Signed-off-by: Richard Alpe <richard.a...@ericsson.com> --- net/tipc/udp_media.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c index 49b3c2e..0cc0224 100644 --- a/net/tipc/udp_media.c +++ b/net/tipc/udp_media.c @@ -54,6 +54,7 @@ #define UDP_PORT_DEFAULT 6118 #define UDP_MIN_HEADROOM 28 +#define UDP_IPV6_MIN_HEADROOM 48 /** * struct udp_media_addr - IP/UDP addressing information @@ -150,11 +151,6 @@ static int tipc_udp_send_msg(struct net *net, struct sk_buff *skb, struct udp_media_addr *src = (struct udp_media_addr *)&b->addr.value; struct rtable *rt; - if (skb_headroom(skb) < UDP_MIN_HEADROOM) { - err = pskb_expand_head(skb, UDP_MIN_HEADROOM, 0, GFP_ATOMIC); - if (err) - goto tx_error; - } skb_set_inner_protocol(skb, htons(ETH_P_TIPC)); ub = rcu_dereference_rtnl(b->media_ptr); @@ -163,6 +159,12 @@ static int tipc_udp_send_msg(struct net *net, struct sk_buff *skb, goto tx_error; } if (dst->proto == htons(ETH_P_IP)) { + if (skb_headroom(skb) < UDP_MIN_HEADROOM) { + err = pskb_expand_head(skb, UDP_MIN_HEADROOM, 0, + GFP_ATOMIC); + if (err) + goto tx_error; + } struct flowi4 fl = { .daddr = dst->ipv4.s_addr, .saddr = src->ipv4.s_addr, @@ -189,6 +191,12 @@ static int tipc_udp_send_msg(struct net *net, struct sk_buff *skb, .saddr = src->ipv6, .flowi6_proto = IPPROTO_UDP }; + if (skb_headroom(skb) < UDP_IPV6_MIN_HEADROOM) { + err = pskb_expand_head(skb, UDP_IPV6_MIN_HEADROOM, 0, + GFP_ATOMIC); + if (err) + goto tx_error; + } err = ipv6_stub->ipv6_dst_lookup(net, ub->ubsock->sk, &ndst, &fl6); if (err) -- 2.1.4 ------------------------------------------------------------------------------ Transform Data into Opportunity. Accelerate data analysis in your applications with Intel Data Analytics Acceleration Library. Click to learn more. http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140 _______________________________________________ tipc-discussion mailing list tipc-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tipc-discussion