[PATCH 1/2] nvme-tcp: validate R2T PDU in nvme_tcp_handle_r2t()

Varun Prakash varun at chelsio.com
Mon Nov 22 06:34:27 PST 2021


On Mon, Nov 22, 2021 at 12:45:14PM +0200, Sagi Grimberg wrote:
> 
> >@@ -2321,6 +2327,9 @@ static blk_status_t nvme_tcp_setup_cmd_pdu(struct nvme_ns *ns,
> >  	req->data_sent = 0;
> >  	req->pdu_len = 0;
> >  	req->pdu_sent = 0;
> >+	req->h2cdata_left = 0;
> >+	req->h2cdata_offset = 0;
> >+	req->h2cdata_ttag = 0;
> 
> This doesn't hurt anything, but it also redundant AFAICT no? these are
> only referenced in nvme_tcp_setup_h2c_data_pdu which is called from
> nvme_tcp_handle_r2t, which is setting these right before the call...

if (req->h2cdata_left) check will also execute for inline data, can it
have a garbage value if driver does not set it to 0?

We can remove h2cdata_offset and h2cdata_ttag as these will be used only for
h2cdata.



More information about the Linux-nvme mailing list