summaryrefslogtreecommitdiffstats
path: root/net/ieee802154
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2015-09-02 14:21:23 +0200
committerMarcel Holtmann <marcel@holtmann.org>2015-09-17 13:20:03 +0200
commit742c3afe53c5d16fa62632c34f8e2273766d3052 (patch)
tree5e4fb120b7ceaeabe7ab0955f8e6e0a90aca0c3c /net/ieee802154
parentad23d5b9da399c0ecbe58e16c6603c3fcdcafdbd (diff)
downloadlinux-742c3afe53c5d16fa62632c34f8e2273766d3052.tar.bz2
ieee802154: 6lowpan: trivial checks at first
This patch moves some trivial checks at first before calling skb_share_check which could do some memcpy if the buffer is shared. Reviewed-by: Stefan Schmidt <stefan@osg.samsung.com> Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/ieee802154')
-rw-r--r--net/ieee802154/6lowpan/rx.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/net/ieee802154/6lowpan/rx.c b/net/ieee802154/6lowpan/rx.c
index 4ddf69445032..74d8fec51a0c 100644
--- a/net/ieee802154/6lowpan/rx.c
+++ b/net/ieee802154/6lowpan/rx.c
@@ -63,7 +63,8 @@ static int lowpan_rcv(struct sk_buff *skb, struct net_device *wdev,
struct net_device *ldev;
int ret;
- if (wdev->type != ARPHRD_IEEE802154)
+ if (wdev->type != ARPHRD_IEEE802154 ||
+ skb->pkt_type == PACKET_OTHERHOST)
goto drop;
ldev = wdev->ieee802154_ptr->lowpan_dev;
@@ -74,9 +75,6 @@ static int lowpan_rcv(struct sk_buff *skb, struct net_device *wdev,
if (!skb)
goto drop;
- if (skb->pkt_type == PACKET_OTHERHOST)
- goto drop_skb;
-
if (ieee802154_hdr_peek_addrs(skb, &hdr) < 0)
goto drop_skb;