Skip to content

Commit

Permalink
ieee802154: 6lowpan: trivial checks at first
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
alexaring authored and holtmann committed Sep 17, 2015
1 parent ad23d5b commit 742c3af
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions net/ieee802154/6lowpan/rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down

0 comments on commit 742c3af

Please sign in to comment.