RE: [PATCH 05/17] nvme: wire-up support for async-passthru on char-device.

Clay Mayers
2022-03-22T15:18:10Z

> From: Kanchan Joshi
> Sent: Tuesday, March 8, 2022 7:21 AM
> To: axboe@kernel.dk; hch@lst.de; kbusch@kernel.org;
> asml.silence@gmail.com
> Cc: io-uring@vger.kernel.org; linux-nvme@lists.infradead.org; linux-
> block@vger.kernel.org; sbates@raithlin.com; logang@deltatee.com;
> pankydev8@gmail.com; javier@javigon.com; mcgrof@kernel.org;
> a.manzanares@samsung.com; joshiiitr@gmail.com; anuj20.g@samsung.com
> Subject: [PATCH 05/17] nvme: wire-up support for async-passthru on char-
> device.
>

<snip>
> +static void nvme_pt_task_cb(struct io_uring_cmd *ioucmd)
> +{
> + struct nvme_uring_cmd_pdu *pdu = nvme_uring_cmd_pdu(ioucmd);
> + struct request *req = pdu->req;
> + int status;
> + struct bio *bio = req->bio;
> +
> + if (nvme_req(req)->flags & NVME_REQ_CANCELLED)
> + status = -EINTR;
> + else
> + status = nvme_req(req)->status;
> +
> + /* we can free request */
> + blk_mq_free_request(req);
> + blk_rq_unmap_user(bio);
> +
> + if (!status && pdu->meta_buffer) {
> + if (copy_to_user(pdu->meta_buffer, pdu->meta, pdu-
> >meta_len))

This copy is incorrectly called for writes.

> + status = -EFAULT;
> + }
> + kfree(pdu->meta);
> +
> + io_uring_cmd_done(ioucmd, status);
> +}