Message ID | 20201119154235.263250-3-sven@narfation.org (mailing list archive) |
---|---|
State | Accepted |
Commit | d35d1375493b0f962a5da5aef015b8bd215e059d |
Delegated to: | Kalle Valo |
Headers | show |
Series | [v2,1/3] ath11k: Don't cast ath11k_skb_cb to ieee80211_tx_info.control | expand |
diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h index 5a7915f75e1e..b5ca4455b2e0 100644 --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h @@ -909,6 +909,8 @@ static inline const char *ath11k_scan_state_str(enum ath11k_scan_state state) static inline struct ath11k_skb_cb *ATH11K_SKB_CB(struct sk_buff *skb) { + BUILD_BUG_ON(sizeof(struct ath11k_skb_cb) > + IEEE80211_TX_INFO_DRIVER_DATA_SIZE); return (struct ath11k_skb_cb *)&IEEE80211_SKB_CB(skb)->driver_data; }
It is rather easy to add more entries to ath11k_skb_cb while forgetting the size limit of ieee80211_tx_info->driver_data. So just check this during the build to reduce the change of accidental buffer overflow in the skbuff->cb. Signed-off-by: Sven Eckelmann <sven@narfation.org> --- v2: - new patch drivers/net/wireless/ath/ath11k/core.h | 2 ++ 1 file changed, 2 insertions(+)