From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 02A16569B for ; Thu, 15 Dec 2022 18:12:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FCB5C433D2; Thu, 15 Dec 2022 18:12:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1671127962; bh=pyepUv49aHr5CnGlPCA68LWtVIZxRoRXDWdIBzwsVOA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GzTRpY7FSGD/8SVroRCkO+Nxb8YgstAUfn+z5hrGCWXf5Q+4gmlRxFDkKOozEDPx5 tubvntwSzi2SstoUZ1bZvcx2VC6YejBUvI9WigWz/yfUghc1Z02ODq5RFYgbER98DE 8D4VkAy7k/N3V+5lL9CZ0YEEk9j+ChK8f7OGj3YY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Lei Rao , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.15 14/14] nvme-pci: clear the prp2 field when not used Date: Thu, 15 Dec 2022 19:10:50 +0100 Message-Id: <20221215172907.335634098@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20221215172906.338769943@linuxfoundation.org> References: <20221215172906.338769943@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Lei Rao [ Upstream commit a56ea6147facce4ac1fc38675455f9733d96232b ] If the prp2 field is not filled in nvme_setup_prp_simple(), the prp2 field is garbage data. According to nvme spec, the prp2 is reserved if the data transfer does not cross a memory page boundary, so clear it to zero if it is not used. Signed-off-by: Lei Rao Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/pci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 772bdc6845fb..d49df7123677 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -814,6 +814,8 @@ static blk_status_t nvme_setup_prp_simple(struct nvme_dev *dev, cmnd->dptr.prp1 = cpu_to_le64(iod->first_dma); if (bv->bv_len > first_prp_len) cmnd->dptr.prp2 = cpu_to_le64(iod->first_dma + first_prp_len); + else + cmnd->dptr.prp2 = 0; return BLK_STS_OK; } -- 2.35.1