net: ieee802154: Avoid ACK processing when not needed

In case hardware CSMA CA is used, ieee802154 L2 does not initialize ACK
processing structures, as it does not need to process ACK messages. As
it is not possible to conditionally disable ACK reporting to the upper
layer, ieee802154 could end up using uninitialized kernel primitive
(semaphore) in the ACK handler, which lead to a crash.

Avoid this, by explicitly checking in the ACK handler, if HW CSMA CA is
used.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
Robert Lubos 2020-03-16 13:15:45 +01:00 committed by Jukka Rissanen
commit 369109b4b2
2 changed files with 10 additions and 0 deletions

View file

@ -50,6 +50,11 @@ static enum net_verdict aloha_radio_handle_ack(struct net_if *iface,
{
struct ieee802154_context *ctx = net_if_l2_data(iface);
if (IS_ENABLED(CONFIG_NET_L2_IEEE802154_RADIO_CSMA_CA) &&
ieee802154_get_hw_capabilities(iface) & IEEE802154_HW_CSMA) {
return NET_OK;
}
return handle_ack(ctx, pkt);
}

View file

@ -77,6 +77,11 @@ static enum net_verdict csma_ca_radio_handle_ack(struct net_if *iface,
{
struct ieee802154_context *ctx = net_if_l2_data(iface);
if (IS_ENABLED(CONFIG_NET_L2_IEEE802154_RADIO_CSMA_CA) &&
ieee802154_get_hw_capabilities(iface) & IEEE802154_HW_CSMA) {
return NET_OK;
}
return handle_ack(ctx, pkt);
}