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 <miquel.raynal@bootlin.com>
This commit is contained in:
Miquel Raynal 2022-09-04 16:06:50 +02:00 committed by Carles Cufí
commit 19e67800f9

View file

@ -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 */