diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/mac802154/rx.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/net/mac802154/rx.c b/net/mac802154/rx.c index b6a4bbfdbf90..c9f1c72a1afc 100644 --- a/net/mac802154/rx.c +++ b/net/mac802154/rx.c | |||
@@ -248,6 +248,7 @@ ieee802154_monitors_rx(struct ieee802154_local *local, struct sk_buff *skb) | |||
248 | void ieee802154_rx(struct ieee802154_hw *hw, struct sk_buff *skb) | 248 | void ieee802154_rx(struct ieee802154_hw *hw, struct sk_buff *skb) |
249 | { | 249 | { |
250 | struct ieee802154_local *local = hw_to_local(hw); | 250 | struct ieee802154_local *local = hw_to_local(hw); |
251 | u16 crc; | ||
251 | 252 | ||
252 | WARN_ON_ONCE(softirq_count() == 0); | 253 | WARN_ON_ONCE(softirq_count() == 0); |
253 | 254 | ||
@@ -256,8 +257,7 @@ void ieee802154_rx(struct ieee802154_hw *hw, struct sk_buff *skb) | |||
256 | * solution because the monitor needs a crc here. | 257 | * solution because the monitor needs a crc here. |
257 | */ | 258 | */ |
258 | if (local->hw.flags & IEEE802154_HW_RX_OMIT_CKSUM) { | 259 | if (local->hw.flags & IEEE802154_HW_RX_OMIT_CKSUM) { |
259 | u16 crc = crc_ccitt(0, skb->data, skb->len); | 260 | crc = crc_ccitt(0, skb->data, skb->len); |
260 | |||
261 | put_unaligned_le16(crc, skb_put(skb, 2)); | 261 | put_unaligned_le16(crc, skb_put(skb, 2)); |
262 | } | 262 | } |
263 | 263 | ||
@@ -265,6 +265,17 @@ void ieee802154_rx(struct ieee802154_hw *hw, struct sk_buff *skb) | |||
265 | 265 | ||
266 | ieee802154_monitors_rx(local, skb); | 266 | ieee802154_monitors_rx(local, skb); |
267 | 267 | ||
268 | /* Check if transceiver doesn't validate the checksum. | ||
269 | * If not we validate the checksum here. | ||
270 | */ | ||
271 | if (local->hw.flags & IEEE802154_HW_RX_DROP_BAD_CKSUM) { | ||
272 | crc = crc_ccitt(0, skb->data, skb->len); | ||
273 | if (crc) { | ||
274 | rcu_read_unlock(); | ||
275 | kfree_skb(skb); | ||
276 | return; | ||
277 | } | ||
278 | } | ||
268 | /* remove crc */ | 279 | /* remove crc */ |
269 | skb_trim(skb, skb->len - 2); | 280 | skb_trim(skb, skb->len - 2); |
270 | 281 | ||