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>
This commit is contained in:

committed by
Marcel Holtmann

vanhempi
c6fdbba3ea
commit
54552d0302
@@ -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;
|
||||
|
Viittaa uudesa ongelmassa
Block a user