diff options
author | Lei Rao <lei.rao@intel.com> | 2022-11-29 17:48:11 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-12-19 12:27:32 +0100 |
commit | 74b139c63f0775cf79266e9d9546c62b73fb3385 (patch) | |
tree | df21d6a8721e58be23b5e647e80de032ff7bb3d3 | |
parent | 77ebf88e003140f10625d998b572ad1dde76d0c1 (diff) | |
download | linux-stable-74b139c63f0775cf79266e9d9546c62b73fb3385.tar.gz linux-stable-74b139c63f0775cf79266e9d9546c62b73fb3385.tar.bz2 linux-stable-74b139c63f0775cf79266e9d9546c62b73fb3385.zip |
nvme-pci: clear the prp2 field when not used
[ 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 <lei.rao@intel.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | drivers/nvme/host/pci.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 089f39103584..c222d7bf6ce1 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -817,6 +817,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; } |