From 19e67800f90cce626afef95ffe995cc8099f307d Mon Sep 17 00:00:00 2001 From: Miquel Raynal Date: Sun, 4 Sep 2022 16:06:50 +0200 Subject: [PATCH] net: l2: ieee802154: Avoid dangling MAC command bits While the packet structures seem to always be reset when they are allocated, it's apparently not the case of the data buffers. Indeed, these are allocated differently and just attached to the packet structure through a frag/buffer member. Experience shows that we may get uninitialized buffers so let's set all MAC parameter bits one by one, even the reserved ones. Signed-off-by: Miquel Raynal --- subsys/net/l2/ieee802154/ieee802154_mgmt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/subsys/net/l2/ieee802154/ieee802154_mgmt.c b/subsys/net/l2/ieee802154/ieee802154_mgmt.c index 27aea961206..51746a14b52 100644 --- a/subsys/net/l2/ieee802154/ieee802154_mgmt.c +++ b/subsys/net/l2/ieee802154/ieee802154_mgmt.c @@ -367,9 +367,11 @@ static int ieee802154_associate(uint32_t mgmt_request, struct net_if *iface, } cmd = ieee802154_get_mac_command(pkt); + cmd->assoc_req.ci.reserved_1 = 0U; /* Reserved */ cmd->assoc_req.ci.dev_type = 0U; /* RFD */ cmd->assoc_req.ci.power_src = 0U; /* TODO: set right power source */ cmd->assoc_req.ci.rx_on = 1U; /* TODO: that will depends on PM */ + cmd->assoc_req.ci.reserved_2 = 0U; /* Reserved */ cmd->assoc_req.ci.sec_capability = 0U; /* TODO: security support */ cmd->assoc_req.ci.alloc_addr = 0U; /* TODO: handle short addr */