From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 9AED337BE64; Sat, 17 Oct 2026 16:35:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792254934; cv=none; b=ZomxJZMGCvefAZFBgcXsRC33IqITHjpoJHSo027HVPzuBILrO6ln1RtzBcDIbt0K/QtNdR8Gw9+jmC7wLJGlmn/RkyFwWL5BZBZzzXdqt/AQg2p0HGzPlik5XoBJmBCAKjFMnq+9VdqAh7qQRtjQZek6YAXGBmBrSFP4zOFCBDc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792254934; c=relaxed/simple; bh=KbaClBdeYPvLM0yZosbYivFpf62Q21k6w8+rMnGIuYw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CvwykiYTYcd50xeUzZfOOs/ji25hwLQXN78ORYb4P+SvUO3cNz9FDGKskiIh1qqpd3EDMT5FoipCZ3kHFQQYL084ZoQXZ52wdsjAQzrkZKeHLE/hYPpVNIhZK0xXEZg8OJzAPa0hQFOZ7DL4oyNd3tgGThYaOG9TSOQmSDbsjyQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=BLszAWFH; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="BLszAWFH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E45231F000C4; Sat, 17 Oct 2026 16:35:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1792254933; bh=sg32zGxrpIyV3jPX22rNJ8iGQU/H+w0iO7QBZcqk4I8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=BLszAWFHghw39a8kLmMn8fOvy6OdV1MEgDvs+BsbiJXRVOrhXkMFkBGgne6xHsqf+ ll01tYt3KZwdB04s++0yVMlJqZu/0n97uTCuiY2qPQ4GkKwti+bLHAULjz2hP51xnb ID6daMTAbJIpL9nQKMMQ7eVdfQV3H7rdPtS14NK0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Leon Romanovsky , Dave Jiang , Marek Szyprowski , Sasha Levin Subject: [PATCH 6.12 557/869] ntb: Store original DMA address for future release Date: Sat, 17 Oct 2026 17:56:38 +0200 Message-ID: <20261017160051.363081595@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261017160036.979869304@linuxfoundation.org> References: <20261017160036.979869304@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Leon Romanovsky [ Upstream commit da6d997ac556479c112554ab5d95cbd04683eb11 ] The DMA API requires that dma_free_attrs receive the exact dma_handle originally returned by the allocation function. Do not modify it. Fixes: fc5d1829f9bf ("NTB: transport: Try harder to alloc an aligned MW buffer") Signed-off-by: Leon Romanovsky Reviewed-by: Dave Jiang Signed-off-by: Marek Szyprowski Link: https://lore.kernel.org/r/20260501-dma-attrs-debug-v2-1-8dbac75cd501@nvidia.com Signed-off-by: Sasha Levin --- drivers/ntb/ntb_transport.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c index 3928bcbc830d0..398b0e0ff842e 100644 --- a/drivers/ntb/ntb_transport.c +++ b/drivers/ntb/ntb_transport.c @@ -211,6 +211,7 @@ struct ntb_transport_mw { void *alloc_addr; void *virt_addr; dma_addr_t dma_addr; + dma_addr_t original_dma_addr; }; struct ntb_transport_client_dev { @@ -800,7 +801,7 @@ static void ntb_free_mw(struct ntb_transport_ctx *nt, int num_mw) ntb_mw_clear_trans(nt->ndev, PIDX, num_mw); dma_free_coherent(dma_dev, mw->alloc_size, - mw->alloc_addr, mw->dma_addr); + mw->alloc_addr, mw->original_dma_addr); mw->xlat_size = 0; mw->buff_size = 0; mw->alloc_size = 0; @@ -836,6 +837,7 @@ static int ntb_alloc_mw_buffer(struct ntb_transport_mw *mw, return -ENOMEM; } virt_addr = alloc_addr; + mw->original_dma_addr = dma_addr; /* * we must ensure that the memory address allocated is BAR size -- 2.53.0