linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Manikanta Pubbisetty <quic_mpubbise@quicinc.com>
To: <ath11k@lists.infradead.org>
Cc: <linux-wireless@vger.kernel.org>,
	Manikanta Pubbisetty <quic_mpubbise@quicinc.com>
Subject: [PATCH v4 1/3] ath11k: Fix double free issue during SRNG deinit
Date: Fri, 3 Feb 2023 11:31:26 +0530	[thread overview]
Message-ID: <20230203060128.19625-2-quic_mpubbise@quicinc.com> (raw)
In-Reply-To: <20230203060128.19625-1-quic_mpubbise@quicinc.com>

Currently struct ath11k_hal::srng_config pointer is not assigned
to NULL after freeing the memory in ath11k_hal_srng_deinit().
This could lead to double free issue in a scenario where
ath11k_hal_srng_deinit() is invoked back to back.

In the current code, although the chances are very low, the above
said scenario could happen when hardware recovery has failed and
then there is another FW assert where ath11k_hal_srng_deinit() is
invoked once again as part of recovery. Addressing this issue is
important when low power mode support is enabled in the driver
(will be added by a future patch) where this scenario is likely.

Fix this by assigning the struct ath11k_hal::srng_config pointer
to NULL after freeing the memory.

Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1
Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.16

Signed-off-by: Manikanta Pubbisetty <quic_mpubbise@quicinc.com>
---
 drivers/net/wireless/ath/ath11k/hal.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/ath/ath11k/hal.c b/drivers/net/wireless/ath/ath11k/hal.c
index 22422237500c..a20bf2792672 100644
--- a/drivers/net/wireless/ath/ath11k/hal.c
+++ b/drivers/net/wireless/ath/ath11k/hal.c
@@ -1324,6 +1324,7 @@ void ath11k_hal_srng_deinit(struct ath11k_base *ab)
 	ath11k_hal_free_cont_rdp(ab);
 	ath11k_hal_free_cont_wrp(ab);
 	kfree(hal->srng_config);
+	hal->srng_config = NULL;
 }
 EXPORT_SYMBOL(ath11k_hal_srng_deinit);
 
-- 
2.38.0


  reply	other threads:[~2023-02-03  6:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-03  6:01 [PATCH v4 0/3] Enable low power mode when WLAN is not active Manikanta Pubbisetty
2023-02-03  6:01 ` Manikanta Pubbisetty [this message]
2023-02-03  6:01 ` [PATCH v4 2/3] ath11k: Move hardware initialization logic to start() Manikanta Pubbisetty
2023-02-03  6:01 ` [PATCH v4 3/3] ath11k: Enable low power mode when WLAN is not active Manikanta Pubbisetty
2023-02-24 14:46   ` Kalle Valo
2023-02-27 10:42     ` Manikanta Pubbisetty
2023-03-13  7:19     ` Manikanta Pubbisetty
2023-02-24 14:50   ` Kalle Valo
2023-02-27 10:49     ` Manikanta Pubbisetty
2023-02-27 11:59       ` Kalle Valo
2023-02-24 14:54 ` [PATCH v4 0/3] " Kalle Valo
2023-02-27 10:49   ` Manikanta Pubbisetty

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=20230203060128.19625-2-quic_mpubbise@quicinc.com \
    --to=quic_mpubbise@quicinc.com \
    --cc=ath11k@lists.infradead.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).