All of lore.kernel.org
 help / color / mirror / Atom feed
From: gregory.greenman@intel.com
To: johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org,
	Johannes Berg <johannes.berg@intel.com>,
	Gregory Greenman <gregory.greenman@intel.com>
Subject: [PATCH 05/11] wifi: iwlwifi: mvm: fix potential memory leak
Date: Tue, 18 Apr 2023 12:28:08 +0300	[thread overview]
Message-ID: <20230418122405.116758321cc4.I8bdbcbb38c89ac637eaa20dda58fa9165b25893a@changeid> (raw)
In-Reply-To: <20230418092814.1438734-1-gregory.greenman@intel.com>

From: Johannes Berg <johannes.berg@intel.com>

If we do get multiple notifications from firmware, then
we might have allocated 'notif', but don't free it. Fix
that by checking for duplicates before allocation.

Fixes: 4da46a06d443 ("wifi: iwlwifi: mvm: Add support for wowlan info notification")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
index 798a7a1299e1..37aa4676dc94 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
@@ -2722,6 +2722,13 @@ static bool iwl_mvm_wait_d3_notif(struct iwl_notif_wait_data *notif_wait,
 	case WIDE_ID(PROT_OFFLOAD_GROUP, WOWLAN_INFO_NOTIFICATION): {
 		struct iwl_wowlan_info_notif *notif;
 
+		if (d3_data->notif_received & IWL_D3_NOTIF_WOWLAN_INFO) {
+			/* We might get two notifications due to dual bss */
+			IWL_DEBUG_WOWLAN(mvm,
+					 "Got additional wowlan info notification\n");
+			break;
+		}
+
 		if (wowlan_info_ver < 2) {
 			struct iwl_wowlan_info_notif_v1 *notif_v1 = (void *)pkt->data;
 
@@ -2740,13 +2747,6 @@ static bool iwl_mvm_wait_d3_notif(struct iwl_notif_wait_data *notif_wait,
 			notif = (void *)pkt->data;
 		}
 
-		if (d3_data->notif_received & IWL_D3_NOTIF_WOWLAN_INFO) {
-			/* We might get two notifications due to dual bss */
-			IWL_DEBUG_WOWLAN(mvm,
-					 "Got additional wowlan info notification\n");
-			break;
-		}
-
 		d3_data->notif_received |= IWL_D3_NOTIF_WOWLAN_INFO;
 		len = iwl_rx_packet_payload_len(pkt);
 		iwl_mvm_parse_wowlan_info_notif(mvm, notif, d3_data->status,
-- 
2.38.1


  parent reply	other threads:[~2023-04-18  9:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-18  9:28 [PATCH 00/11] wifi: iwlwifi: updates intended for v6.4 2023-04-18 gregory.greenman
2023-04-18  9:28 ` [PATCH 01/11] wifi: iwlwifi: Update support for b0 version gregory.greenman
2023-04-18  9:28 ` [PATCH 02/11] wifi: iwlwifi: fw: fix memory leak in debugfs gregory.greenman
2023-04-18  9:28 ` [PATCH 03/11] wifi: iwlwifi: mvm: fix MIC removal confusion gregory.greenman
2023-04-18  9:28 ` [PATCH 04/11] wifi: iwlwifi: fw: fix argument to efi.get_variable gregory.greenman
2023-04-18  9:28 ` gregory.greenman [this message]
2023-04-18  9:28 ` [PATCH 06/11] wifi: iwlwifi: mvm: prefer RCU_INIT_POINTER() gregory.greenman
2023-04-18  9:28 ` [PATCH 07/11] wifi: iwlwifi: mvm: enable support for MLO APIs gregory.greenman
2023-04-18  9:28 ` [PATCH 08/11] wifi: iwlwifi: modify scan request and results when in link protection gregory.greenman
2023-04-18  9:28 ` [PATCH 09/11] wifi: iwlwifi: mei: make mei filtered scan more aggressive gregory.greenman
2023-04-18  9:28 ` [PATCH 10/11] wifi: iwlwifi: mei: re-ask for ownership after it was taken by CSME gregory.greenman
2023-04-18  9:28 ` [PATCH 11/11] wifi: iwlwifi: mvm: fix RFKILL report when driver is going down gregory.greenman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230418122405.116758321cc4.I8bdbcbb38c89ac637eaa20dda58fa9165b25893a@changeid \
    --to=gregory.greenman@intel.com \
    --cc=johannes.berg@intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.