With hardware FCS enabled the chip replaces the FCS bytes with a correlation
value, a FCS flag and the rssi value.

We need to make sure that both bytes are getting clipped before sending them
into the stack as functions checking for the length will fail otherwise.

Signed-off-by: Stefan Schmidt <ste...@datenfreihafen.org>
---
 drivers/ieee802154/cc2420.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/ieee802154/cc2420.c b/drivers/ieee802154/cc2420.c
index 3cc2724..f8fab59 100644
--- a/drivers/ieee802154/cc2420.c
+++ b/drivers/ieee802154/cc2420.c
@@ -367,8 +367,9 @@ static int cc2420_rx(struct cc2420_local *lp)
                return -EINVAL;
        }
 
-       skb_trim(skb, len-1); /* We do not put CRC and Corr into
-                                                       the frame, but remain 
rssi value */
+       /* Clip last two bytes. When using hardware FCS they get replaced with
+        * correlation value, FCS flag and RSSI value */
+       skb_trim(skb, len-2);
 
        ieee802154_rx_irqsafe(lp->dev, skb, lqi);
 
-- 
1.7.1


------------------------------------------------------------------------------
_______________________________________________
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel

Reply via email to