From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A8675D3C52C for ; Thu, 17 Oct 2024 18:11:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=etn9n3K2FYwhUv/6MyZmlU07gUzECo4F0FGdO4UaRjs=; b=21kgUkbVWOfDRmRkJdivWuqpIJ tVSO5viYUo0llXvidGByY2DnqeWad6MTFhQnAeB15jJELAKiYkpq8s67otxrlMZqhOCnMHMyglFjn nU1AmNyTAcp7Bg6En2P5AbhZcHCIctF9vzjiq6616ZgeXpCe5lLtQxRrfiISDETjGybUNIPvgjFPR DpHPLP6+54iOMq1MEzVjYn9g/fC0vmjf3DZ/WQYpNeYBlBFQP78TCUrR01ACIk9J4k3vf4zs33XYW fydQWn6KWPTz7qgPekO6OX17hdFUbd/aC5zXOQKyRk5T0YpehjFKO5fl9scLYQKie+hjANNRmms+b x9njqGtw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1UyL-0000000FpiG-1Bdi for ath12k@archiver.kernel.org; Thu, 17 Oct 2024 18:11:41 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1UxL-0000000FpYo-13fA for ath12k@lists.infradead.org; Thu, 17 Oct 2024 18:10:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729188638; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=etn9n3K2FYwhUv/6MyZmlU07gUzECo4F0FGdO4UaRjs=; b=B2GaSIwAR9bz9P151jPQ+deQOPp1/b2NJPIny9cNg8+ldpt5fSQsx59SkrZMQP7+75xfdY Xa+ZWztJTLJne5gSmoYMzqOt76k9m4J65iW+T1Uy8gFHH2KyrpV//ruuFvvCVKvzcxMETH fbrZNZf0Hg9YJhD5Qrrnor4UmukqjpA= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-88-5VWHVNujMmSyb77wIBdAsg-1; Thu, 17 Oct 2024 14:10:36 -0400 X-MC-Unique: 5VWHVNujMmSyb77wIBdAsg-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3957619560B4; Thu, 17 Oct 2024 18:10:35 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.39.192.106]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 890F71956086; Thu, 17 Oct 2024 18:10:32 +0000 (UTC) From: Jose Ignacio Tornos Martinez To: kvalo@kernel.org, jjohnson@kernel.org, linux-wireless@vger.kernel.org, ath12k@lists.infradead.org, linux-kernel@vger.kernel.org Cc: jtornosm@redhat.com, stable@vger.kernel.org Subject: [PATCH v4 2/2] wifi: ath12k: fix warning when unbinding Date: Thu, 17 Oct 2024 20:07:32 +0200 Message-ID: <20241017181004.199589-3-jtornosm@redhat.com> In-Reply-To: <20241017181004.199589-1-jtornosm@redhat.com> References: <20241017181004.199589-1-jtornosm@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241017_111039_432020_C670F156 X-CRM114-Status: GOOD ( 13.26 ) X-BeenThere: ath12k@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "ath12k" Errors-To: ath12k-bounces+ath12k=archiver.kernel.org@lists.infradead.org If there is an error during some initialization related to firmware, the buffers dp->tx_ring[i].tx_status are released. However this is released again when the device is unbinded (ath12k_pci), and we get: WARNING: CPU: 0 PID: 2098 at mm/slub.c:4689 free_large_kmalloc+0x4d/0x80 Call Trace: free_large_kmalloc ath12k_dp_free ath12k_core_deinit ath12k_pci_remove ... The issue is always reproducible from a VM because the MSI addressing initialization is failing. In order to fix the issue, just set the buffers to NULL after releasing in order to avoid the double free. cc: stable@vger.kernel.org Fixes: d889913205cf ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices") Signed-off-by: Jose Ignacio Tornos Martinez --- v4: - Send with cover letter to get reference with 1/2 v3: https://lore.kernel.org/linux-wireless/20241017074854.176765-1-jtornosm@redhat.com/ v2: https://lore.kernel.org/linux-wireless/20241016123722.206899-1-jtornosm@redhat.com/ v1: https://lore.kernel.org/linux-wireless/20241010175102.207324-3-jtornosm@redhat.com/ drivers/net/wireless/ath/ath12k/dp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath12k/dp.c b/drivers/net/wireless/ath/ath12k/dp.c index 789d430e4455..15061782a2df 100644 --- a/drivers/net/wireless/ath/ath12k/dp.c +++ b/drivers/net/wireless/ath/ath12k/dp.c @@ -1277,8 +1277,10 @@ void ath12k_dp_free(struct ath12k_base *ab) ath12k_dp_rx_reo_cmd_list_cleanup(ab); - for (i = 0; i < ab->hw_params->max_tx_ring; i++) + for (i = 0; i < ab->hw_params->max_tx_ring; i++) { kfree(dp->tx_ring[i].tx_status); + dp->tx_ring[i].tx_status = NULL; + } ath12k_dp_rx_free(ab); /* Deinit any SOC level resource */ -- 2.47.0