Received: by 2002:ab2:5c0e:0:b0:1ef:a325:1205 with SMTP id i14csp103207lqk; Wed, 13 Mar 2024 18:28:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVAwf8GuusF8sU3lON/Aw+YBTk51hKBko36KSR3oAfjDEPux9/l+zs1QuL3HW07kKFX5LPG5Ucygdl8nvkxZcvzU1/oYMhT2GBCRgkRAQ== X-Google-Smtp-Source: AGHT+IHBlGG0C+czKq2hAJHnXsqzqcV1rT2MVLUDIw/7mSLjw4L+fA3pahS9d2RelvF8xMI0t9co X-Received: by 2002:a05:6830:1bf1:b0:6e4:ece7:beb6 with SMTP id k17-20020a0568301bf100b006e4ece7beb6mr527478otb.26.1710379734708; Wed, 13 Mar 2024 18:28:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710379734; cv=pass; d=google.com; s=arc-20160816; b=NAC3xNzZToP34U9i/cIqTyKdnyt+oYnNDYuolloJxhTabSAtdZ6/QwX9ILpcjnGHFm EibntcDLOWZP8J0WTbpx++qI4VcJYXqt/Mm0U9IVybJqVRLY6aInno0KNW3X6xxQ8fbi dhCSvZ6eMHizwFpjNfFxJwW/7xQx7Nf546dj8bqYcmfgVBg7jtTB/R7EN5buKGQWylfU QzCzXgImpyTwwTjwd6TphR9xiFFKYLP27oqgkUzpNqhMGrgGAoCXkUZjRvzMoJCbXJzp 8OyikVlMgyNI7M2IX9hoA6R8YE+3On06npd3Q/OtJJVsmZawx3vmDK1VKGPbuxcEwQEg 3PDg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=9GeWyRDTBwCzlBj4XSX3keRBXiH6I8DYE/DRXqfudtk=; fh=lutRC40ZQ73mR7S36xODCn9KuPGicup/ZQQz41RILwI=; b=aDP/ujqNzP1llQi0UXsMFRPqRdalGLYw6plsH3MNhN/VIGEPYJAEg59AJjhjepEjDI wyuS04ESrotHhVDsMhNoVOFrp9DVCQNTqeGycPJGZtvMpqHO4+/XKvMaFYO2I9WPZhNX YaMicWlIL0GW5GDgZdR+axPqWy/GoJOwD1wNV/TEGvlu9oW/viKUbBOWd472hdi0Ox93 cRjS+sQlUdEIbxYUor+bXotftmXlahHduxjFph7bQw9PmG9902+k9C4hyG9ykoJNzwq8 PwrDn9gKoIIALIn4/8mtyWtGSPQ5cSP+/HXqy5VdPXvLqOYJxxpOT9ZoXMZBj1zfM6/j arHA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=GLMHdTsr; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-wireless+bounces-4721-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4721-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id s1-20020a6550c1000000b005e4837345a3si502891pgp.400.2024.03.13.18.28.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 18:28:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-4721-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=GLMHdTsr; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-wireless+bounces-4721-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4721-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 3E37B284F9E for ; Thu, 14 Mar 2024 01:28:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 29B243211; Thu, 14 Mar 2024 01:28:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="GLMHdTsr" X-Original-To: linux-wireless@vger.kernel.org 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 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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; } -- 2.25.1