Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ipv4: use skb_expand_head in ip_finish_output2

Unlike skb_realloc_headroom, new helper skb_expand_head
does not allocate a new skb if possible.

Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Vasily Averin and committed by
David S. Miller
5678a595 0c9f227b

+2 -11
+2 -11
net/ipv4/ip_output.c
··· 198 198 } else if (rt->rt_type == RTN_BROADCAST) 199 199 IP_UPD_PO_STATS(net, IPSTATS_MIB_OUTBCAST, skb->len); 200 200 201 - /* Be paranoid, rather than too clever. */ 202 201 if (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) { 203 - struct sk_buff *skb2; 204 - 205 - skb2 = skb_realloc_headroom(skb, LL_RESERVED_SPACE(dev)); 206 - if (!skb2) { 207 - kfree_skb(skb); 202 + skb = skb_expand_head(skb, hh_len); 203 + if (!skb) 208 204 return -ENOMEM; 209 - } 210 - if (skb->sk) 211 - skb_set_owner_w(skb2, skb->sk); 212 - consume_skb(skb); 213 - skb = skb2; 214 205 } 215 206 216 207 if (lwtunnel_xmit_redirect(dst->lwtstate)) {