]> git.baikalelectronics.ru Git - kernel.git/commit
nvmet-tcp: fix regression in data_digest calculation
authorSagi Grimberg <sagi@grimberg.me>
Thu, 23 Jun 2022 21:49:53 +0000 (00:49 +0300)
committerChristoph Hellwig <hch@lst.de>
Wed, 29 Jun 2022 14:13:44 +0000 (16:13 +0200)
commit13103d5001201e380918ad5b739ae70783f0a9f0
tree9669ac49b47b63509c07c910416262adeee8958d
parent726f7142eca1a8c8760aeb291eb633821320c719
nvmet-tcp: fix regression in data_digest calculation

Data digest calculation iterates over command mapped iovec. However
since commit 8ce4bfe68658 we unmap the iovec before we handle the data
digest, and since commit 8162a936941e we clear nr_mapped when we unmap
the iov.

Instead of open-coding the command iov traversal, simply call
crypto_ahash_digest with the command sg that is already allocated (we
already do that for the send path). Rename nvmet_tcp_send_ddgst to
nvmet_tcp_calc_ddgst and call it from send and recv paths.

Fixes: 8162a936941e ("nvmet-tcp: add an helper to free the cmd buffers")
Fixes: 8ce4bfe68658 ("nvmet-tcp: fix kmap leak when data digest in use")
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/target/tcp.c