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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48193C4332F for ; Thu, 15 Dec 2022 18:14:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229809AbiLOSNi (ORCPT ); Thu, 15 Dec 2022 13:13:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230295AbiLOSNQ (ORCPT ); Thu, 15 Dec 2022 13:13:16 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D00B4731F for ; Thu, 15 Dec 2022 10:13:10 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 319EB61EA7 for ; Thu, 15 Dec 2022 18:13:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38A31C433EF; Thu, 15 Dec 2022 18:13:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1671127989; bh=sLFnxQ8KdDFsbpCr7Ub0zv1OPy+heet3m84NrOcex7s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2gYMXD8NB5HiNqSMZWUNT3FezbdJM2GoyATmyQxNPobYUD1ipyBsLxhRCrEFJfOLb TZnkf2v6qV0JYPVeW6DBTx9PCKvjIye+xKIg/m5NFqOMpqeWTe+KBzDUdkZf4c3kIQ 13f/1Q+PKzWGN89bM3C90rDgByLeJe9CoiEcpYkE= 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 6.0 16/16] nvme-pci: clear the prp2 field when not used Date: Thu, 15 Dec 2022 19:11:00 +0100 Message-Id: <20221215172908.902154711@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20221215172908.162858817@linuxfoundation.org> References: <20221215172908.162858817@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 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 0f34114c4596..6867620bcc98 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -804,6 +804,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