[PATCH 1/4] nvme-tcp: fix a possible use-after-free in controller reset during load

Christoph Hellwig hch at lst.de
Tue Feb 1 00:03:35 PST 2022


On Sun, Jan 30, 2022 at 11:21:16AM +0200, Sagi Grimberg wrote:
>  	struct nvme_tcp_cmd_pdu *pdu = ctrl->async_req.pdu;
>  	struct nvme_command *cmd = &pdu->cmd;
>  	u8 hdgst = nvme_tcp_hdgst_len(queue);
> +	bool queue_ready = test_bit(NVME_TCP_Q_LIVE, &queue->flags);
> +
> +	if (ctrl->ctrl.state != NVME_CTRL_LIVE || !queue_ready)

Why do we need the local variable?

Also what prevents the controller or queue state to change just after
this check?



More information about the Linux-nvme mailing list