[PATCH v5 1/1] nvme : Add ctrl id to allowed passthru commands

Keith Busch kbusch at kernel.org
Mon Dec 5 07:35:17 PST 2022


On Mon, Dec 05, 2022 at 03:27:46PM +0100, Joel Granados wrote:
> Add NVME_ID_CNS_CS_CTRL and NVME_ID_CNS_CTRL to the nvme admin commands
> that are allowed in unprivileged passthru. This will allow access to
> attributes that are needed to effectively write to the char device in
> passthru.
> 
> Signed-off-by: Joel Granados <j.granados at samsung.com>

I initially thought just open the entire nvme_identify_controller
opcode, but this looks good to me.

Reviewed-by: Keith Busch <kbusch at kernel.org>

> ---
>  drivers/nvme/host/ioctl.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c
> index 9550a69029b3..9ddda571f046 100644
> --- a/drivers/nvme/host/ioctl.c
> +++ b/drivers/nvme/host/ioctl.c
> @@ -34,6 +34,8 @@ static bool nvme_cmd_allowed(struct nvme_ns *ns, struct nvme_command *c,
>  			case NVME_ID_CNS_NS:
>  			case NVME_ID_CNS_CS_NS:
>  			case NVME_ID_CNS_NS_CS_INDEP:
> +			case NVME_ID_CNS_CS_CTRL:
> +			case NVME_ID_CNS_CTRL:
>  				return true;
>  			}
>  		}
> -- 
> 2.30.2
> 



More information about the Linux-nvme mailing list