All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sagi Grimberg <sagi@grimberg.me>
To: Amit Engel <amit.engel@dell.com>,
	linux-nvme@lists.infradead.org, hch@lst.de
Subject: Re: [PATCH] nvmet_tcp: fix header digest verification
Date: Tue, 19 Oct 2021 15:18:34 +0300	[thread overview]
Message-ID: <2f46c62b-a8c4-5d48-17c4-ac33dec8a318@grimberg.me> (raw)
In-Reply-To: <20211019113307.31852-1-amit.engel@dell.com>


> pass the correct length to nvmet_tcp_hdgst.
> when verify_hdgst, need to pass pdu header len.
> This fixes a wrong behaviour where
> header digest verification pass although digest is wrong

Amit, can you describe what you mean here?
what is wrong about the digest?

What is currently passed in len is queue->offset, which is
the temporary offset from the pdu, which is equal to hdr->hlen
because we verify the digest right after we finish reading the PDU
header.

> 
> Signed-off-by: Amit Engel <amit.engel@dell.com>
> ---
>   drivers/nvme/target/tcp.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
> index 6eb0b3153477..954c27a94561 100644
> --- a/drivers/nvme/target/tcp.c
> +++ b/drivers/nvme/target/tcp.c
> @@ -268,7 +268,7 @@ static int nvmet_tcp_verify_hdgst(struct nvmet_tcp_queue *queue,
>   	}
>   
>   	recv_digest = *(__le32 *)(pdu + hdr->hlen);
> -	nvmet_tcp_hdgst(queue->rcv_hash, pdu, len);
> +	nvmet_tcp_hdgst(queue->rcv_hash, pdu, hdr->hlen);

If at all, the caller should pass hdr->hlen and keep this generic.


       reply	other threads:[~2021-10-19 12:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20211019113307.31852-1-amit.engel@dell.com>
2021-10-19 12:18 ` Sagi Grimberg [this message]
2021-10-20 15:43   ` [PATCH] nvmet_tcp: fix header digest verification Engel, Amit
2021-10-20 17:53     ` Sagi Grimberg
2021-10-25  8:47       ` Engel, Amit
2021-10-26 15:34         ` Sagi Grimberg
2021-10-27  6:50           ` Engel, Amit
     [not found] <20211027064927.20452-1-amit.engel@dell.com>
2021-10-27  7:09 ` Sagi Grimberg
2021-10-27  7:21 ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2f46c62b-a8c4-5d48-17c4-ac33dec8a318@grimberg.me \
    --to=sagi@grimberg.me \
    --cc=amit.engel@dell.com \
    --cc=hch@lst.de \
    --cc=linux-nvme@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.