提交 a19faf02 编写于 作者: E Eric Dumazet 提交者: David S. Miller

net: fix skb_defer_rx_timestamp()

After commit c1f19b51 (net: support time stamping in phy devices.),
kernel might crash if CONFIG_NETWORK_PHY_TIMESTAMPING=y and
skb_defer_rx_timestamp() handles a packet without an ethernet header.

Fixes kernel bugzilla #24102

Reference: https://bugzilla.kernel.org/show_bug.cgi?id=24102Reported-and-tested-by: NAndrew Watts <akwatts@ymail.com>
Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 c710245c
...@@ -96,11 +96,13 @@ bool skb_defer_rx_timestamp(struct sk_buff *skb) ...@@ -96,11 +96,13 @@ bool skb_defer_rx_timestamp(struct sk_buff *skb)
struct phy_device *phydev; struct phy_device *phydev;
unsigned int type; unsigned int type;
skb_push(skb, ETH_HLEN); if (skb_headroom(skb) < ETH_HLEN)
return false;
__skb_push(skb, ETH_HLEN);
type = classify(skb); type = classify(skb);
skb_pull(skb, ETH_HLEN); __skb_pull(skb, ETH_HLEN);
switch (type) { switch (type) {
case PTP_CLASS_V1_IPV4: case PTP_CLASS_V1_IPV4:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册