[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241121170257.275607-1-pperego@suse.de>
Date: Thu, 21 Nov 2024 18:02:57 +0100
From: Paolo Perego <pperego@...e.de>
To: linux-wireless@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Miri Korenblit <miriam.rachel.korenblit@...el.com>,
Kalle Valo <kvalo@...nel.org>,
Johannes Berg <johannes.berg@...el.com>,
Shaul Triebitz <shaul.triebitz@...el.com>,
Emmanuel Grumbach <emmanuel.grumbach@...el.com>,
Yedidya Benshimol <yedidya.ben.shimol@...el.com>,
Benjamin Berg <benjamin.berg@...el.com>,
Paolo Perego <pperego@...e.de>
Subject: [PATCH] drivers:wireless: Fix a dereference before null check issue
This patch fixes a dereference before null check issue discovered by
Coverity (CID 1601547)
In iwl_mvm_parse_wowlan_info_notif() routine data is checked against
NULL value at line 2501 but it has been dereferenced three lines before
when calculating sizeof() in an assignment.
Signed-off-by: Paolo Perego <pperego@...e.de>
---
drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
index f85c01e04ebf..f733c16ffd8e 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
@@ -2495,8 +2495,7 @@ static void iwl_mvm_parse_wowlan_info_notif(struct iwl_mvm *mvm,
struct iwl_wowlan_status_data *status,
u32 len)
{
- u32 expected_len = sizeof(*data) +
- data->num_mlo_link_keys * sizeof(status->mlo_keys[0]);
+ u32 expected_len = 0;
if (!data) {
IWL_ERR(mvm, "iwl_wowlan_info_notif data is NULL\n");
@@ -2504,6 +2503,8 @@ static void iwl_mvm_parse_wowlan_info_notif(struct iwl_mvm *mvm,
return;
}
+ expected_len = sizeof(*data) + data->num_mlo_link_keys * sizeof(status->mlo_keys[0]);
+
if (len < expected_len) {
IWL_ERR(mvm, "Invalid WoWLAN info notification!\n");
status = NULL;
--
2.47.0
Powered by blists - more mailing lists