mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 05:16:57 +00:00
wifi: move action code from per-type frame structs
The action code actually serves to identify the type of action frame, so it really isn't part of the per-type structure. Pull it out and have it in the general action frame format. In theory, whether or not the action code is present in this way is up to each category, but all categories that are defined right now all have that value. While at it, and since this change requires changing all users, remove the 'u' and make it an anonymous union in this case, so that all code using this changes. Change IEEE80211_MIN_ACTION_SIZE to take an argument which says how much of the frame is needed, e.g. category, action_code or the specific frame type that's defined in the union. Again this also ensures that all code is updated. In some cases, fix bugs where the SKB length was checked after having accessed beyond the checked length, in particular in FTM code, e.g. ieee80211_is_ftm(). Link: https://patch.msgid.link/20260226183607.67e71846b59e.I9a24328e3ffcaae179466a935f1c3345029f9961@changeid Signed-off-by: Johannes Berg <[email protected]>
This commit is contained in:
committed by
Felix Fietkau
parent
2c84469c8f
commit
d49721c205
+3
-3
@@ -422,10 +422,10 @@ mt76_connac2_mac_write_txwi_80211(struct mt76_dev *dev, __le32 *txwi,
|
|||||||
u32 val;
|
u32 val;
|
||||||
|
|
||||||
if (ieee80211_is_action(fc) &&
|
if (ieee80211_is_action(fc) &&
|
||||||
skb->len >= IEEE80211_MIN_ACTION_SIZE + 1 &&
|
skb->len >= IEEE80211_MIN_ACTION_SIZE(addba_req.capab) &&
|
||||||
mgmt->u.action.category == WLAN_CATEGORY_BACK &&
|
mgmt->u.action.category == WLAN_CATEGORY_BACK &&
|
||||||
mgmt->u.action.u.addba_req.action_code == WLAN_ACTION_ADDBA_REQ) {
|
mgmt->u.action.action_code == WLAN_ACTION_ADDBA_REQ) {
|
||||||
u16 capab = le16_to_cpu(mgmt->u.action.u.addba_req.capab);
|
u16 capab = le16_to_cpu(mgmt->u.action.addba_req.capab);
|
||||||
|
|
||||||
txwi[5] |= cpu_to_le32(MT_TXD5_ADD_BA);
|
txwi[5] |= cpu_to_le32(MT_TXD5_ADD_BA);
|
||||||
tid = (capab >> 2) & IEEE80211_QOS_CTL_TID_MASK;
|
tid = (capab >> 2) & IEEE80211_QOS_CTL_TID_MASK;
|
||||||
|
|||||||
+2
-2
@@ -687,9 +687,9 @@ mt7925_mac_write_txwi_80211(struct mt76_dev *dev, __le32 *txwi,
|
|||||||
u32 val;
|
u32 val;
|
||||||
|
|
||||||
if (ieee80211_is_action(fc) &&
|
if (ieee80211_is_action(fc) &&
|
||||||
skb->len >= IEEE80211_MIN_ACTION_SIZE + 1 &&
|
skb->len >= IEEE80211_MIN_ACTION_SIZE(action_code) &&
|
||||||
mgmt->u.action.category == WLAN_CATEGORY_BACK &&
|
mgmt->u.action.category == WLAN_CATEGORY_BACK &&
|
||||||
mgmt->u.action.u.addba_req.action_code == WLAN_ACTION_ADDBA_REQ)
|
mgmt->u.action.action_code == WLAN_ACTION_ADDBA_REQ)
|
||||||
tid = MT_TX_ADDBA;
|
tid = MT_TX_ADDBA;
|
||||||
else if (ieee80211_is_mgmt(hdr->frame_control))
|
else if (ieee80211_is_mgmt(hdr->frame_control))
|
||||||
tid = MT_TX_NORMAL;
|
tid = MT_TX_NORMAL;
|
||||||
|
|||||||
+2
-2
@@ -774,9 +774,9 @@ mt7996_mac_write_txwi_80211(struct mt7996_dev *dev, __le32 *txwi,
|
|||||||
u32 val;
|
u32 val;
|
||||||
|
|
||||||
if (ieee80211_is_action(fc) &&
|
if (ieee80211_is_action(fc) &&
|
||||||
skb->len >= IEEE80211_MIN_ACTION_SIZE + 1 &&
|
skb->len >= IEEE80211_MIN_ACTION_SIZE(action_code) &&
|
||||||
mgmt->u.action.category == WLAN_CATEGORY_BACK &&
|
mgmt->u.action.category == WLAN_CATEGORY_BACK &&
|
||||||
mgmt->u.action.u.addba_req.action_code == WLAN_ACTION_ADDBA_REQ) {
|
mgmt->u.action.action_code == WLAN_ACTION_ADDBA_REQ) {
|
||||||
if (is_mt7990(&dev->mt76))
|
if (is_mt7990(&dev->mt76))
|
||||||
txwi[6] |= cpu_to_le32(FIELD_PREP(MT_TXD6_TID_ADDBA, tid));
|
txwi[6] |= cpu_to_le32(FIELD_PREP(MT_TXD6_TID_ADDBA, tid));
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user