Re: [PATCH] nvme: disallow passthru cmd from targeting a nsid != nsid of the block dev

From: Christoph Hellwig
Date: Thu Mar 25 2021 - 12:31:38 EST


On Thu, Mar 25, 2021 at 09:48:37AM +0000, Niklas Cassel wrote:
> @@ -1632,6 +1632,8 @@ static int nvme_user_cmd(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
> return -EFAULT;
> if (cmd.flags)
> return -EINVAL;
> + if (ns && cmd.nsid != ns->head->ns_id)
> + return -EINVAL;

Shouldn't we log something to the kernel log including the device
and current->comm?