Commit 4d90b0d1 authored by John Fastabend's avatar John Fastabend Committed by Greg Kroah-Hartman

net: pktgen: fix null ptr deref in skb allocation

[ Upstream commit 3de03596 ]

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>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8ece8070
......@@ -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