]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
nvmet-tcp: Don't set the request's data_len
authorLogan Gunthorpe <logang@deltatee.com>
Wed, 23 Oct 2019 16:35:40 +0000 (10:35 -0600)
committerJens Axboe <axboe@kernel.dk>
Mon, 4 Nov 2019 17:56:41 +0000 (10:56 -0700)
It's not apprporiate for the transports to set the data_len
field of the request which is only used by the core.

In this case, just use a variable on the stack to store the
length of the sgl for comparison.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/nvme/target/tcp.c

index 1e2d92f818ad87ba20237fb437638f59c2ca2cb4..3378480c49f6a9d712f758a3cf91da3582f08783 100644 (file)
@@ -813,13 +813,11 @@ free_crypto:
 static void nvmet_tcp_handle_req_failure(struct nvmet_tcp_queue *queue,
                struct nvmet_tcp_cmd *cmd, struct nvmet_req *req)
 {
+       size_t data_len = le32_to_cpu(req->cmd->common.dptr.sgl.length);
        int ret;
 
-       /* recover the expected data transfer length */
-       req->data_len = le32_to_cpu(req->cmd->common.dptr.sgl.length);
-
        if (!nvme_is_write(cmd->req.cmd) ||
-           req->data_len > cmd->req.port->inline_data_size) {
+           data_len > cmd->req.port->inline_data_size) {
                nvmet_prepare_receive_pdu(queue);
                return;
        }