Skip to content

Commit

Permalink
net: fix skb_defer_rx_timestamp()
Browse files Browse the repository at this point in the history
After commit c1f19b5 (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=24102
Reported-and-tested-by: Andrew Watts <akwatts@ymail.com>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and davem330 committed Dec 11, 2010
1 parent c710245 commit a19faf0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions net/core/timestamping.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,13 @@ bool skb_defer_rx_timestamp(struct sk_buff *skb)
struct phy_device *phydev;
unsigned int type;

skb_push(skb, ETH_HLEN);
if (skb_headroom(skb) < ETH_HLEN)
return false;
__skb_push(skb, ETH_HLEN);

type = classify(skb);

skb_pull(skb, ETH_HLEN);
__skb_pull(skb, ETH_HLEN);

switch (type) {
case PTP_CLASS_V1_IPV4:
Expand Down

0 comments on commit a19faf0

Please sign in to comment.