[PATCH] nvme-tcp: fix a segmentation fault during io parsing error

Hou Pu houpu.main at gmail.com
Tue Mar 16 09:35:39 GMT 2021


Hi Elad and Sagi,

I think this bug is the same one I am trying to fix. Sorry I did not notice
Elad was trying to fix this in time.

Elad, could please take a look at this thread. I think these two bug are same.
The callback is same.

[PATCH] nvmet-tcp: finish receiving before send back response if nvmet_req_init() failed.
https://lore.kernel.org/linux-nvme/a4ae0e4b-3d59-3a5a-1533-4545e2e4633e@gmail.com/T/#t

>@@ -476,7 +477,11 @@ static struct nvmet_tcp_cmd *nvmet_tcp_fetch_cmd(struct nvmet_tcp_queue *queue)
>   	  nvmet_setup_c2h_data_pdu(queue->snd_cmd);
>-	else
>+	else if (nvmet_tcp_has_data_in(queue->snd_cmd) &&
>+			       +nvmet_tcp_has_inline_data(queue->snd_cmd)) {
>+		nvmet_tcp_queue_response(&queue->snd_cmd->req);
>+		queue->snd_cmd = NULL;
>+	} else

Here when we get a new cmd and find it has data remains to be read.
I think that in fact this request might already been replied by nvmet_req_init().
And the inline data should also be consumed by read it from the socket.


Thanks,
Hou




More information about the Linux-nvme mailing list