summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2015-09-02 14:21:29 +0200
committerMarcel Holtmann <marcel@holtmann.org>2015-09-17 13:20:04 +0200
commit54552d03023cfd485cedf8d7471d1554139d58aa (patch)
tree9e624523707527367ae0c385bcc6445117c6bd07 /net
parentc6fdbba3eadd5af695c1290c59fe917ce8d9295f (diff)
ieee802154: 6lowpan: check on valid 802.15.4 frame
This patch adds frame control checks to check if the received frame is something which could contain a 6LoWPAN packet. 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')
-rw-r--r--net/ieee802154/6lowpan/rx.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/net/ieee802154/6lowpan/rx.c b/net/ieee802154/6lowpan/rx.c
index 45ce121369c2..f7eb091203a8 100644
--- a/net/ieee802154/6lowpan/rx.c
+++ b/net/ieee802154/6lowpan/rx.c
@@ -11,6 +11,7 @@
#include <linux/if_arp.h>
#include <net/6lowpan.h>
+#include <net/mac802154.h>
#include <net/ieee802154_netdev.h>
#include "6lowpan_i.h"
@@ -280,6 +281,13 @@ static inline bool lowpan_is_reserved(u8 dispatch)
*/
static inline bool lowpan_rx_h_check(struct sk_buff *skb)
{
+ __le16 fc = ieee802154_get_fc_from_skb(skb);
+
+ /* check on ieee802154 conform 6LoWPAN header */
+ if (!ieee802154_is_data(fc) ||
+ !ieee802154_is_intra_pan(fc))
+ return false;
+
/* check if we can dereference the dispatch */
if (unlikely(!skb->len))
return false;