mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Aditya Kumar Singh <quic_adisi@quicinc.com>
To: Jeff Johnson <jeff.johnson@oss.qualcomm.com>,
	Kalle Valo <kvalo@kernel.org>, Jeff Johnson <jjohnson@kernel.org>,
	"Karthikeyan Periyasamy" <quic_periyasa@quicinc.com>,
	Harshitha Prem <quic_hprem@quicinc.com>
Cc: Kalle Valo <quic_kvalo@quicinc.com>,
	<linux-wireless@vger.kernel.org>, <ath12k@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 05/10] wifi: ath12k: fix SLUB BUG - Object already free in ath12k_reg_free()
Date: Mon, 20 Jan 2025 14:08:32 +0530	[thread overview]
Message-ID: <086df6fc-c601-4e06-8433-f87e2bd01ec5@quicinc.com> (raw)
In-Reply-To: <22fdc80a-7ad9-4305-8435-0422d201b1ce@oss.qualcomm.com>

On 1/14/25 00:51, Jeff Johnson wrote:
>> diff --git a/drivers/net/wireless/ath/ath12k/reg.c b/drivers/net/wireless/ath/ath12k/reg.c
>> index 439d61f284d89222e79c05d6cff8e85d0d315aad..b4d7fa1a04ca0e72728e8989c29b82d089171fc2 100644
>> --- a/drivers/net/wireless/ath/ath12k/reg.c
>> +++ b/drivers/net/wireless/ath/ath12k/reg.c
>> @@ -1,7 +1,7 @@
>>   // SPDX-License-Identifier: BSD-3-Clause-Clear
>>   /*
>>    * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
>> - * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
>> + * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved.
>>    */
>>   #include <linux/rtnetlink.h>
>>   #include "core.h"
>> @@ -777,8 +777,14 @@ void ath12k_reg_free(struct ath12k_base *ab)
>>   {
>>   	int i;
>>   
>> +	if (ab->regd_freed)
>> +		return;
>> +
>>   	for (i = 0; i < ab->hw_params->max_radios; i++) {
>>   		kfree(ab->default_regd[i]);
>>   		kfree(ab->new_regd[i]);
>> +		ab->default_regd[i] = NULL;
>> +		ab->new_regd[i] = NULL;
>> +		ab->regd_freed = true;
> since it is loop invariant, should this last assignment be outside the loop,
> either before or after the loop?
> 
> but then again, why is a flag needed since setting the pointers to NULL should
> already show they are freed, and any race conditions with those pointers would
> also exist with the new flag (which you have addressed with the locking change).

Well, looks like, this flag is not needed. I will remove this in next 
version. Thanks for pointing it out!

-- 
Aditya

  reply	other threads:[~2025-01-20  8:38 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-09  4:25 [PATCH 00/10] wifi: ath12k: fixes for rmmod and recovery issues with hardware grouping Aditya Kumar Singh
2025-01-09  4:25 ` [PATCH 01/10] wifi: ath12k: prevent race condition in ath12k_core_hw_group_destroy() Aditya Kumar Singh
2025-01-13 19:06   ` Jeff Johnson
2025-01-09  4:25 ` [PATCH 02/10] wifi: ath12k: add reference counting for core attachment to hardware group Aditya Kumar Singh
2025-01-13 19:06   ` Jeff Johnson
2025-01-09  4:25 ` [PATCH 03/10] wifi: ath12k: fix failed to set mhi state error during reboot with hardware grouping Aditya Kumar Singh
2025-01-13 19:07   ` Jeff Johnson
2025-01-09  4:25 ` [PATCH 04/10] wifi: ath12k: fix firmware assert " Aditya Kumar Singh
2025-01-13 19:12   ` Jeff Johnson
2025-01-16 10:43     ` Aditya Kumar Singh
2025-01-09  4:25 ` [PATCH 05/10] wifi: ath12k: fix SLUB BUG - Object already free in ath12k_reg_free() Aditya Kumar Singh
2025-01-13 19:21   ` Jeff Johnson
2025-01-20  8:38     ` Aditya Kumar Singh [this message]
2025-01-09  4:25 ` [PATCH 06/10] wifi: ath12k: fix ath12k_core_pre_reconfigure_recovery() with grouping Aditya Kumar Singh
2025-01-13 19:22   ` Jeff Johnson
2025-01-09  4:25 ` [PATCH 07/10] wifi: ath12k: fix ATH12K_FLAG_REGISTERED flag handling Aditya Kumar Singh
2025-01-13 19:23   ` Jeff Johnson
2025-01-09  4:25 ` [PATCH 08/10] wifi: ath12k: handle ath12k_core_restart() with hardware grouping Aditya Kumar Singh
2025-01-13 19:23   ` Jeff Johnson
2025-01-09  4:25 ` [PATCH 09/10] wifi: ath12k: handle ath12k_core_reset() " Aditya Kumar Singh
2025-01-13 19:24   ` Jeff Johnson
2025-01-09  4:25 ` [PATCH 10/10] wifi: ath12k: reset MLO global memory during recovery Aditya Kumar Singh
2025-01-13 19:25   ` Jeff Johnson

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=086df6fc-c601-4e06-8433-f87e2bd01ec5@quicinc.com \
    --to=quic_adisi@quicinc.com \
    --cc=ath12k@lists.infradead.org \
    --cc=jeff.johnson@oss.qualcomm.com \
    --cc=jjohnson@kernel.org \
    --cc=kvalo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=quic_hprem@quicinc.com \
    --cc=quic_kvalo@quicinc.com \
    --cc=quic_periyasa@quicinc.com \
    /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

all inboxes | Powered by JetHome®