diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2010-12-05 18:50:32 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-12-10 16:20:56 -0800 |
commit | a19faf0250e09b16cac169354126404bc8aa342b (patch) | |
tree | 1d77cd6906181069ef3b5d1508c99c9a02f3e340 /net/core | |
parent | c710245caa41060e983cc9cb5ffcc020e02ca45f (diff) | |
download | blackbird-op-linux-a19faf0250e09b16cac169354126404bc8aa342b.tar.gz blackbird-op-linux-a19faf0250e09b16cac169354126404bc8aa342b.zip |
net: fix skb_defer_rx_timestamp()
After commit c1f19b51d1d8 (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>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/timestamping.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/net/core/timestamping.c b/net/core/timestamping.c index 0ae6c22da85b..c19bb4ee405e 100644 --- a/net/core/timestamping.c +++ b/net/core/timestamping.c @@ -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: |