[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230623152443.2296825-2-arnd@kernel.org>
Date: Fri, 23 Jun 2023 17:24:00 +0200
From: Arnd Bergmann <arnd@...nel.org>
To: Johannes Berg <johannes@...solutions.net>
Cc: Arnd Bergmann <arnd@...db.de>,
Christian Lamparter <chunkeey@...glemail.com>,
Kalle Valo <kvalo@...nel.org>,
Johannes Berg <johannes.berg@...el.com>,
Kees Cook <keescook@...omium.org>,
linux-wireless@...r.kernel.org, linux-kernel@...r.kernel.org,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Gregory Greenman <gregory.greenman@...el.com>,
Benjamin Berg <benjamin.berg@...el.com>,
Ryder Lee <ryder.lee@...iatek.com>,
Ilan Peer <ilan.peer@...el.com>, Felix Fietkau <nbd@....name>,
Aloka Dixit <quic_alokad@...cinc.com>,
Avraham Stern <avraham.stern@...el.com>,
Emmanuel Grumbach <emmanuel.grumbach@...el.com>,
netdev@...r.kernel.org
Subject: [PATCH 2/2] mac80211: make ieee80211_tx_info padding explicit
From: Arnd Bergmann <arnd@...db.de>
While looking at a bug, I got rather confused by the layout of the
'status' field in ieee80211_tx_info. Apparently, the intention is that
status_driver_data[] is used for driver specific data, and fills up the
size of the union to 40 bytes, just like the other ones.
This is indeed what actually happens, but only because of the
combination of two mistakes:
- "void *status_driver_data[18 / sizeof(void *)];" is intended
to be 18 bytes long but is actually two bytes shorter because of
rounding-down in the division, to a multiple of the pointer
size (4 bytes or 8 bytes).
- The other fields combined are intended to be 22 bytes long, but
are actually 24 bytes because of padding in front of the
unaligned tx_time member, and in front of the pointer array.
The two mistakes cancel out. so the size ends up fine, but it seems
more helpful to make this explicit, by having a multiple of 8 bytes
in the size calculation and explicitly describing the padding.
Fixes: ea5907db2a9cc ("mac80211: fix struct ieee80211_tx_info size")
Fixes: 02219b3abca59 ("mac80211: add WMM admission control support")
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
include/net/mac80211.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 3a8a2d2c58c38..ca4dc8a14f1bb 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1192,9 +1192,11 @@ struct ieee80211_tx_info {
u8 ampdu_ack_len;
u8 ampdu_len;
u8 antenna;
+ u8 pad;
u16 tx_time;
u8 flags;
- void *status_driver_data[18 / sizeof(void *)];
+ u8 pad2;
+ void *status_driver_data[16 / sizeof(void *)];
} status;
struct {
struct ieee80211_tx_rate driver_rates[
--
2.39.2
Powered by blists - more mailing lists