Subject: [PATCH] wifi: mac80211: Fix potential he_6ghz_oper NULL pointer access

Signed-off-by: Michael-CY Lee <[email protected]>
---
include/linux/ieee80211.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 3308e85..a23ec4c 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -2671,12 +2671,14 @@ ieee80211_he_oper_size(const u8 *he_oper_ie)
static inline const struct ieee80211_he_6ghz_oper *
ieee80211_he_6ghz_oper(const struct ieee80211_he_operation *he_oper)
{
- const u8 *ret = (const void *)&he_oper->optional;
+ const u8 *ret;
u32 he_oper_params;

if (!he_oper)
return NULL;

+ ret = (const void *)&he_oper->optional;
+
he_oper_params = le32_to_cpu(he_oper->he_oper_params);

if (!(he_oper_params & IEEE80211_HE_OPERATION_6GHZ_OP_INFO))
--
2.25.1