Commit 3de03596 authored by John Fastabend's avatar John Fastabend Committed by David S. Miller

net: pktgen: fix null ptr deref in skb allocation

Fix possible null pointer dereference that may occur when calling
skb_reserve() on a null skb.

Fixes: 879c7220 ("net: pktgen: Observe needed_headroom of the device")
Signed-off-by: default avatarJohn Fastabend <john.r.fastabend@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 366f2931
......@@ -2787,7 +2787,9 @@ static struct sk_buff *pktgen_alloc_skb(struct net_device *dev,
} else {
skb = __netdev_alloc_skb(dev, size, GFP_NOWAIT);
}
skb_reserve(skb, LL_RESERVED_SPACE(dev));
if (likely(skb))
skb_reserve(skb, LL_RESERVED_SPACE(dev));
return skb;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment