[PATCH] nvmet-tcp: fix a segmentation fault during io parsing error
Hou Pu
houpu.main at gmail.com
Fri Mar 26 10:26:36 GMT 2021
On Date: Fri, 26 Mar 2021 00:49:52 +0200, Elad Grupi wrote:
> diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
> index 70cc507d1565..f10fa2b5aaeb 100644
> --- a/drivers/nvme/target/tcp.c
> +++ b/drivers/nvme/target/tcp.c
> @@ -154,6 +154,7 @@ static struct workqueue_struct *nvmet_tcp_wq;
> static const struct nvmet_fabrics_ops nvmet_tcp_ops;
> static void nvmet_tcp_free_cmd(struct nvmet_tcp_cmd *c);
> static void nvmet_tcp_finish_cmd(struct nvmet_tcp_cmd *cmd);
> +static void nvmet_tcp_queue_response(struct nvmet_req *req);
Do we need declare it here?
> @@ -1103,9 +1121,14 @@ static int nvmet_tcp_try_recv_data(struct nvmet_tcp_queue *queue)
> return 0;
> }
> - if (!(cmd->flags & NVMET_TCP_F_INIT_FAILED) &&
> - cmd->rbytes_done == cmd->req.transfer_len) {
> - cmd->req.execute(&cmd->req);
> + if (cmd->rbytes_done == cmd->req.transfer_len) {
> + if (unlikely(cmd->flags & NVMET_TCP_F_INIT_FAILED))
> + nvmet_tcp_queue_response(&cmd->req);
> + else {
> + if (unlikely(cmd == &queue->connect))
> + nvmet_tcp_executing_connect_cmd(queue);
Is this in somewhere not yet upstream? I did not find
nvmet_tcp_executing_connect_cmd on upstream (5.12-rc4).
> + cmd->req.execute(&cmd->req);
> + }
Hi Elad,
The patch looks ok to me except these 2 question.
Thanks,
Hou
More information about the Linux-nvme
mailing list