提交 3de03596 编写于 作者: J John Fastabend 提交者: 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: NJohn Fastabend <john.r.fastabend@intel.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册