Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -2787,6 +2787,8 @@ static struct sk_buff *pktgen_alloc_skb(struct net_device *dev,
	} else {
		 skb = __netdev_alloc_skb(dev, size, GFP_NOWAIT);
	}

	if (likely(skb))
		skb_reserve(skb, LL_RESERVED_SPACE(dev));

	return skb;