Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2428878imj; Mon, 18 Feb 2019 05:57:50 -0800 (PST) X-Google-Smtp-Source: AHgI3IbBEUVOTTiKXfVpFOv8k/ADExFR6hCXVZaflnBs5XYENlJmjQVtV1fTDii8o8SzApMU7anE X-Received: by 2002:a63:dc53:: with SMTP id f19mr18519571pgj.406.1550498270583; Mon, 18 Feb 2019 05:57:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550498270; cv=none; d=google.com; s=arc-20160816; b=ZIb/dQ0X2OcqZa2kt3TevqSx6HCm6bcPVPtPGapBC6T/0aNiOQZ2rJ8VbM8uNOnyxI 31hHio+hTwf8swM0tiUuUtSU2QeX3kKYkuRFEV+rna2dUCmJNJO/BP0gTF0v64esYv6J 067zK3UezYAAvf0sevbiF+J1VAtzIG6tQNNcsXeHmxDvSrqJ01wA5UgsRqCVhULF8aTv 6M+nP3cEt/ZFqxsgN+RqEoVdtSRdDJAx09/kl/Tli3IUMos/T0H6sGXVsh839spMxmLG XscstvNVqQbnEiOyXyDGeeOe0X1+4EzVl6gu1Kd2zfoGAGkyaN7tOf6BXptLewmNeHiI mYOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=d1odO/dH8WmF5iQertO+fg3UxCd0nh4UALWs5QhGOyQ=; b=n+Z4w8J9CjRWwrxomynw2sLPG1/AhnWsBxLoWNMgViZgHR6BWVOGBvHY43WwkT/WvS SDTT2sMSGMrZ8QDxD3ARYfrVgMzuaV8olwQO3fBbuSzFZ9lANTGddJ3V6BgEsonQJwHv TGXpBUfpwIUuMHUdl0IYTJp5BYjfljM6IAZiNHyIShPRN1gVq9G089H9IklZ5RN3ZKrH hmAY0fJsxQ52W+BJHEwfwBKotn79P2yaITQ3kmrN/pKXCFrd7xtKOp8AfIwDwJZOIJiH 21e0kTnDPuBNkfETTC8N3JSa8bWRbcKR8fGejB6KwkTAnEAHWcpjCILs3kl2DIjiu0AR TwkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bJ+2699X; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g132si13869465pfb.23.2019.02.18.05.57.35; Mon, 18 Feb 2019 05:57:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bJ+2699X; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732364AbfBRNza (ORCPT + 99 others); Mon, 18 Feb 2019 08:55:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:35514 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387528AbfBRNz1 (ORCPT ); Mon, 18 Feb 2019 08:55:27 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 91D942077B; Mon, 18 Feb 2019 13:55:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550498127; bh=O+0odnefRpdwelyxl34YRXKO0UZFLK0Xh68rIN2Gqyk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bJ+2699XlGfdonx9hGn09HQJWH3qs/VJOnhy2YjuoqyvrAweGa6Zi7lyD1hSz1z5R KI72CLSvXBWI1gzEIe/los5PnhquM6MxlNMxlYs97VJh6UZfPCMoyByQu5prE2q8xb rinGEivuC17/vXs0wNFWXoA9v+PjzDG/AZEBcz2g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liviu Dudau , Christoph Hellwig , Sasha Levin Subject: [PATCH 4.14 32/62] nvme-pci: use the same attributes when freeing host_mem_desc_bufs. Date: Mon, 18 Feb 2019 14:43:38 +0100 Message-Id: <20190218133508.709483503@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218133505.801423074@linuxfoundation.org> References: <20190218133505.801423074@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit cc667f6d5de023ee131e96bb88e5cddca23272bd ] When using HMB the PCIe host driver allocates host_mem_desc_bufs using dma_alloc_attrs() but frees them using dma_free_coherent(). Use the correct dma_free_attrs() function to free the buffers. Signed-off-by: Liviu Dudau Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/pci.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index afb99876fa9e..06355ca832db 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -1624,8 +1624,9 @@ static void nvme_free_host_mem(struct nvme_dev *dev) struct nvme_host_mem_buf_desc *desc = &dev->host_mem_descs[i]; size_t size = le32_to_cpu(desc->size) * dev->ctrl.page_size; - dma_free_coherent(dev->dev, size, dev->host_mem_desc_bufs[i], - le64_to_cpu(desc->addr)); + dma_free_attrs(dev->dev, size, dev->host_mem_desc_bufs[i], + le64_to_cpu(desc->addr), + DMA_ATTR_NO_KERNEL_MAPPING | DMA_ATTR_NO_WARN); } kfree(dev->host_mem_desc_bufs); @@ -1691,8 +1692,9 @@ static int __nvme_alloc_host_mem(struct nvme_dev *dev, u64 preferred, while (--i >= 0) { size_t size = le32_to_cpu(descs[i].size) * dev->ctrl.page_size; - dma_free_coherent(dev->dev, size, bufs[i], - le64_to_cpu(descs[i].addr)); + dma_free_attrs(dev->dev, size, bufs[i], + le64_to_cpu(descs[i].addr), + DMA_ATTR_NO_KERNEL_MAPPING | DMA_ATTR_NO_WARN); } kfree(bufs); -- 2.19.1