From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796380934; b=y4NizwJ2vL92pBlNMcSi9bqhK90ACfsPC72tJ4DnlBQ4A2Dw8ijmpsOSGJwoMvRo0YXY 0kds9blu1QAlO0gBlRnjIRdC2vMqJv2izGrr3DlE6NWoTMsRYa8twpbDrOlM3ntScd68B kKhU67F44KHZjzAuMoO3pxVyA0bzUIzFWo+puQmRYWjpNkGijj0/vJDyaA1x/smiPqfUw 5gsPphTcE1D+gNSlfAVrFStiwKD3BvXTCtl6NCqb/6aUk6HJLGZgYYbsh6LXPl2yd1wV8 wwR5uwX3ndMpl5s3QavfMbm70ah/Ad8xtX8j0GaoG7i0bw11zgmfJsxjhAV9fFrZiFA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796380934; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=U5TLXVVb60H6yv4mgKj0ANTAOcWooffDE9yDO+DmLqU=; b=iZJAl6l7BNhAGgueYQ21wfQodDufvfld9onk5dwyslTVNmgo6KDJcQCykuxcLvGLK3cM vCT6zAssikhHYlk8PPeK70RtVGrvKOra8nn61yDzddssNFHJ+VSM94pW3ODJQi52/B8p5 Qmjvsm1sVvfLUnqlOM/AxIz9uCPcAmdFhxErd3YvW9BlXVOS9exP9UQ8IPfItTj5IsERW JDTdqCbCEAB0xHJ/hyCGyFGx3mOrdTC2YVzY5Zk/XW6CBm3dkQCiSqewvLuvdnLayag/h UbZ5cDTniPSYMYtUf34ySh1+sOnh7eBCkulMcCGCIzzHNiXb7FW6Mrix7IACxBOsgvw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=NxKMkYNZ; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30144606A322; Fri, 4 Dec 2026 10:42:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=NxKMkYNZ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E1961F000C2; Fri, 4 Dec 2026 10:42:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796380934; bh=U5TLXVVb60H6yv4mgKj0ANTAOcWooffDE9yDO+DmLqU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=NxKMkYNZeYWCBtgzIQySOQpW3C4B5+t1zj3zBRjJBEQJz93FuuX1h5vZ22fG3l9dz OfbwAVPjYAOVpmvtjZxskZ90WEcD17F6943qOuNpCcwAO1hlrgvu+DkMEaU1j7ZJRl T/RM7/aIgStKpb7zYaYPRzC8EqGx3ZLWKrDNjbro= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Joas Antonio dos Santos , Luiz Augusto von Dentz Subject: [PATCH 7.3 446/742] Bluetooth: hci_qca: clear qca_memdump when discarding dump packets Date: Fri, 4 Dec 2026 19:05:10 +0900 Message-ID: <20261204100646.997883230@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Joas Antonio dos Santos commit 45a25a1bfd267d9e420119a48e5291d7882395df upstream. qca_controller_memdump() frees qca_memdump when a memdump packet with a non-zero sequence number arrives while QCA_MEMDUMP_COLLECTION is not set, but leaves qca->qca_memdump pointing at the freed object. The next run of the work reads the stale pointer into its local variable, skips the allocation and uses the freed memory. Another packet with a non-zero sequence number frees it a second time, and a packet with sequence number 0 writes ram_dump_size, current_seq_no and received_dump into it. The original code cleared the pointer here; the assignment was dropped when the condition was changed to test QCA_MEMDUMP_COLLECTION. All other places that free the structure clear the pointer. A controller that sends two memdump events without a leading sequence number 0 can trigger a use-after-free or double free of a kmalloc object. Found by LLM-assisted source review. Fixes: 06d3fdfcdf5c ("Bluetooth: hci_qca: Add qcom devcoredump support") Cc: stable@vger.kernel.org Signed-off-by: Joas Antonio dos Santos Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Greg Kroah-Hartman --- drivers/bluetooth/hci_qca.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -1132,6 +1132,7 @@ static void qca_controller_memdump(struc if (!test_bit(QCA_MEMDUMP_COLLECTION, &qca->flags)) { bt_dev_err(hu->hdev, "QCA: Discarding other packets"); kfree(qca_memdump); + qca->qca_memdump = NULL; kfree_skb(skb); mutex_unlock(&qca->hci_memdump_lock); return;