mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-15 22:41:38 +00:00
net: pktgen: fix null ptr deref in skb allocation
[ Upstream commit3de03596df] 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
8ece807074
commit
4d90b0d1c1
@@ -2787,6 +2787,8 @@ static struct sk_buff *pktgen_alloc_skb(struct net_device *dev,
|
|||||||
} else {
|
} else {
|
||||||
skb = __netdev_alloc_skb(dev, size, GFP_NOWAIT);
|
skb = __netdev_alloc_skb(dev, size, GFP_NOWAIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (likely(skb))
|
||||||
skb_reserve(skb, LL_RESERVED_SPACE(dev));
|
skb_reserve(skb, LL_RESERVED_SPACE(dev));
|
||||||
|
|
||||||
return skb;
|
return skb;
|
||||||
|
|||||||
Reference in New Issue
Block a user