From patchwork Thu Mar 14 01:27:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaoqing Pan X-Patchwork-Id: 780473 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7BB621C01 for ; Thu, 14 Mar 2024 01:28:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710379732; cv=none; b=W5CsihGA8QkvUElqQJ0mbQzyNxTavMF8BfIzZ2EYbeHJFJelPU79K5IA6UUWweYoCwyjtwNZqsOC6uDgXAwnGUaVZArpqV8LwbiDN9nQ3g7ANRsQD+taTCKKy+nLZYMlp/7J5G+NrSeoc1VwsJFDnuowaMbAQWnBcbrwpRbbr7k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710379732; c=relaxed/simple; bh=g3Y336IsJUIRf5sBB1SyTWwcaN7r+jyNC62AO76iWRc=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=sbTccC8jE8FPTztU8EPAVRblOE8LEc5E7yjj4w4HUAWXwyzjV9JY3Ti6Rc8UvWOZ/HnSa33x46TNhyPspnKFtdNHlhZ/0EklIeDTiprCrpMNC1c+5U+w4ZiEmDoct3pUiKQY3lk91ZhYv3Z8kXanG1AKbrufrjOpvXVr4wWnspo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=GLMHdTsr; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="GLMHdTsr" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42E0DVEl003885; Thu, 14 Mar 2024 01:28:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding:content-type; s=qcppdkim1; bh=9GeWyRD TBwCzlBj4XSX3keRBXiH6I8DYE/DRXqfudtk=; b=GLMHdTsrEoF9mbq7KtavxAj NLmiJSTeO5h9TSGdDm5RBdHxPaPho0bgdJtsgHO6GRllOeNyOMRPgxXwemrCHfrs AAruA8KPACvglHdY/SJxx3Q68x/PB7AoYOTftcIs3rlRnujWxO3VowIpgf0XkhyT kxDhRCYBoZauF3Auozc2PJ6CTmTQAJ9nWD0M8oHTS0co64eabnCisBTVqgGug9O7 OP1gZGHm6dVM+deEccDxIzYmDdKpHkwO7LByCohXyhYKGZ/GffKt89WqG/rpPago n0kkqB+kb3CXGhuTPz6zUWBDLy2wWn3Kak5FAi+dJ4J85jpS49zZtp22YSLjfhg= = Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wub3nhtax-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Mar 2024 01:28:42 +0000 (GMT) Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 42E1SfnV016411 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Mar 2024 01:28:41 GMT Received: from Z2-SFF-G9-MQ.ap.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Wed, 13 Mar 2024 18:28:40 -0700 From: Miaoqing Pan To: CC: , , , Miaoqing Pan Subject: [PATCH] wifi: ath12k: fix memory leak in ath12k_pci_remove() Date: Thu, 14 Mar 2024 09:27:46 +0800 Message-ID: <20240314012746.2729101-1-quic_miaoqing@quicinc.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: Yp2UEAoaOv0CYS-2v_PpXs04nwqQHpie X-Proofpoint-ORIG-GUID: Yp2UEAoaOv0CYS-2v_PpXs04nwqQHpie X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-13_11,2024-03-13_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 lowpriorityscore=0 adultscore=0 clxscore=1011 impostorscore=0 mlxlogscore=985 malwarescore=0 phishscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2403140006 Kmemleak reported this error: unreferenced object 0xffff1c165cec3060 (size 32): comm "insmod", pid 560, jiffies 4296964570 (age 235.596s) backtrace: [<000000005434db68>] __kmem_cache_alloc_node+0x1f4/0x2c0 [<000000001203b155>] kmalloc_trace+0x40/0x88 [<0000000028adc9c8>] _request_firmware+0xb8/0x608 [<00000000cad1aef7>] firmware_request_nowarn+0x50/0x80 [<000000005011a682>] local_pci_probe+0x48/0xd0 [<00000000077cd295>] pci_device_probe+0xb4/0x200 [<0000000087184c94>] really_probe+0x150/0x2c0 The firmware memory was allocated in ath12k_pci_probe(), but not freed in ath12k_pci_remove() in case ATH12K_FLAG_QMI_FAIL bit is set. So call ath12k_fw_unmap() to free the memory. Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.2.0-02280-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1 Signed-off-by: Miaoqing Pan --- drivers/net/wireless/ath/ath12k/pci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/ath/ath12k/pci.c b/drivers/net/wireless/ath/ath12k/pci.c index 14954bc05144..f4b48f96a223 100644 --- a/drivers/net/wireless/ath/ath12k/pci.c +++ b/drivers/net/wireless/ath/ath12k/pci.c @@ -1505,6 +1505,7 @@ static void ath12k_pci_remove(struct pci_dev *pdev) if (test_bit(ATH12K_FLAG_QMI_FAIL, &ab->dev_flags)) { ath12k_pci_power_down(ab); ath12k_qmi_deinit_service(ab); + ath12k_fw_unmap(ab); goto qmi_fail; }