[PATCH 2/2] nvme: Don't use a stack buffer for keep-alive command

Roland Dreier roland at kernel.org
Tue Jan 16 14:46:43 PST 2018


> I think we'll need to fix this properly and embedd the struct nvme_command
> into struct nvme_request.  In the end any command could get an error
> without DNR, and then we'd have a stale SQE on the stack.

I don't understand.  Are there other places that submit requests with
a pointer to stack memory?  I haven't audited everything but I don't
know of any places that submit a command and then free it before
getting status back.

The issue I'm fixing is that we don't copy the command out of the
requests cmd pointer until we're ready to queue the command to
hardware, and that could be after the keepalive function has returned.
With my patch, as long as the controller struct doesn't go away with
requests pending, the keepalive command buffer will be valid no matter
when we use it.

 - R.



More information about the Linux-nvme mailing list