[<prev] [next>] [day] [month] [year] [list]
Message-ID: <535ce5e9-9ad0-4a8e-9fc2-0e759417d1b5@web.de>
Date: Mon, 3 Mar 2025 14:04:08 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: kernel-janitors@...r.kernel.org, linux-wireless@...r.kernel.org,
netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
Johannes Berg <johannes.berg@...el.com>, Kalle Valo <kvalo@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, Sriram R <quic_srirrama@...cinc.com>,
Stanislaw Gruszka <stf_xl@...pl>
Cc: cocci@...ia.fr, LKML <linux-kernel@...r.kernel.org>,
Simon Horman <horms@...nel.org>
Subject: [PATCH RESEND] iwlegacy: Adjust input parameter validation in
il_set_ht_add_station()
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Wed, 19 Apr 2023 18:35:55 +0200
The address of a data structure member was determined before
a corresponding null pointer check in the implementation of
the function “il_set_ht_add_station”.
Thus avoid the risk for undefined behaviour by moving the assignment
for the variable “sta_ht_inf” behind the null pointer check.
This issue was detected by using the Coccinelle software.
Delete also the jump target “done” by using return statements directly
for two if branches.
Fixes: 046d2e7c50e3 ("mac80211: prepare sta handling for MLO support")
Fixes: e7392364fcd1 ("iwlegacy: indentions and whitespaces")
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
drivers/net/wireless/intel/iwlegacy/common.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/intel/iwlegacy/common.c b/drivers/net/wireless/intel/iwlegacy/common.c
index 96002121bb8b..8f6fd17b02a8 100644
--- a/drivers/net/wireless/intel/iwlegacy/common.c
+++ b/drivers/net/wireless/intel/iwlegacy/common.c
@@ -1863,11 +1863,15 @@ EXPORT_SYMBOL(il_send_add_sta);
static void
il_set_ht_add_station(struct il_priv *il, u8 idx, struct ieee80211_sta *sta)
{
- struct ieee80211_sta_ht_cap *sta_ht_inf = &sta->deflink.ht_cap;
+ struct ieee80211_sta_ht_cap *sta_ht_inf;
__le32 sta_flags;
- if (!sta || !sta_ht_inf->ht_supported)
- goto done;
+ if (!sta)
+ return;
+
+ sta_ht_inf = &sta->deflink.ht_cap;
+ if (!sta_ht_inf->ht_supported)
+ return;
D_ASSOC("spatial multiplexing power save mode: %s\n",
(sta->deflink.smps_mode == IEEE80211_SMPS_STATIC) ? "static" :
@@ -1906,8 +1910,6 @@ il_set_ht_add_station(struct il_priv *il, u8 idx, struct ieee80211_sta *sta)
sta_flags &= ~STA_FLG_HT40_EN_MSK;
il->stations[idx].sta.station_flags = sta_flags;
-done:
- return;
}
/*
--
2.40.0
Powered by blists - more mailing lists