This is a note to let you know that I've just added the patch titled nvme: restrict management ioctls to admin to the 6.0-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: nvme-restrict-management-ioctls-to-admin.patch and it can be found in the queue-6.0 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 23e085b2dead13b51fe86d27069895b740f749c0 Mon Sep 17 00:00:00 2001 From: Keith Busch <kbusch@xxxxxxxxxx> Date: Thu, 22 Sep 2022 07:54:06 -0700 Subject: nvme: restrict management ioctls to admin From: Keith Busch <kbusch@xxxxxxxxxx> commit 23e085b2dead13b51fe86d27069895b740f749c0 upstream. The passthrough commands already have this restriction, but the other operations do not. Require the same capabilities for all users as all of these operations, which include resets and rescans, can be disruptive. Signed-off-by: Keith Busch <kbusch@xxxxxxxxxx> Signed-off-by: Christoph Hellwig <hch@xxxxxx> Signed-off-by: Ovidiu Panait <ovidiu.panait@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/nvme/host/ioctl.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/nvme/host/ioctl.c +++ b/drivers/nvme/host/ioctl.c @@ -764,11 +764,17 @@ long nvme_dev_ioctl(struct file *file, u case NVME_IOCTL_IO_CMD: return nvme_dev_user_cmd(ctrl, argp); case NVME_IOCTL_RESET: + if (!capable(CAP_SYS_ADMIN)) + return -EACCES; dev_warn(ctrl->device, "resetting controller\n"); return nvme_reset_ctrl_sync(ctrl); case NVME_IOCTL_SUBSYS_RESET: + if (!capable(CAP_SYS_ADMIN)) + return -EACCES; return nvme_reset_subsystem(ctrl); case NVME_IOCTL_RESCAN: + if (!capable(CAP_SYS_ADMIN)) + return -EACCES; nvme_queue_scan(ctrl); return 0; default: Patches currently in stable-queue which might be from kbusch@xxxxxxxxxx are queue-6.0/nvme-ensure-subsystem-reset-is-single-threaded.patch queue-6.0/nvme-restrict-management-ioctls-to-admin.patch queue-6.0/block-make-dma_alignment-a-stacking-queue_limit.patch queue-6.0/dm-crypt-provide-dma_alignment-limit-in-io_hints.patch