]> git.baikalelectronics.ru Git - kernel.git/commit
nvme-tcp: fix possible crash in write_zeroes processing
authorSagi Grimberg <sagi@grimberg.me>
Mon, 23 Mar 2020 22:06:30 +0000 (15:06 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Apr 2020 14:32:59 +0000 (16:32 +0200)
commit58b78f6a9f73523f490d233fefcc52e624c7b6d5
tree4c87b9ad3b6269f4b421c9cce7e6bf38ab93ed37
parentb3ad475bae144ff0613b03846281c2273cd02cf3
nvme-tcp: fix possible crash in write_zeroes processing

[ Upstream commit d25c4e46a910b76fde992328652d0a58699bead4 ]

We cannot look at blk_rq_payload_bytes without first checking
that the request has a mappable physical segments first (e.g.
blk_rq_nr_phys_segments(rq) != 0) and only then to take the
request payload bytes. This caused us to send a wrong sgl to
the target or even dereference a non-existing buffer in case
we actually got to the data send sequence (if it was in-capsule).

Reported-by: Tony Asleson <tasleson@redhat.com>
Suggested-by: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/host/tcp.c