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

Sagi Grimberg sagi at grimberg.me
Mon Nov 22 06:42:31 PST 2021


>>> @@ -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?

Right, that one needs to reset.



More information about the Linux-nvme mailing list