mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 12:42:02 +00:00
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: 879c7220e8
("net: pktgen: Observe needed_headroom of the device")
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
366f293111
commit
3de03596df
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user