]> git.baikalelectronics.ru Git - kernel.git/commit
nvme: define compat_ioctl again to unbreak 32-bit userspace.
authorNick Bowler <nbowler@draconx.ca>
Thu, 21 Jul 2022 03:57:35 +0000 (23:57 -0400)
committerJens Axboe <axboe@kernel.dk>
Tue, 2 Aug 2022 23:22:48 +0000 (17:22 -0600)
commitede894a493fdc6be45331b0ff56920b2588b6b5d
tree0d2cbf8a50c6bd3a0ccf35d74a4b08bac6b71ed9
parent0d6f4b777bb32a0c5830d93b19ff8bb705eb952d
nvme: define compat_ioctl again to unbreak 32-bit userspace.

Commit 7e042cd0cf1e ("nvme: simplify the compat ioctl handling") removed
the initialization of compat_ioctl from the nvme block_device_operations
structures.

Presumably the expectation was that 32-bit ioctls would be directed
through the regular handler but this is not the case: failing to assign
.compat_ioctl actually means that the compat case is disabled entirely,
and any attempt to submit nvme ioctls from 32-bit userspace fails
outright with -ENOTTY.

For example:

  % smartctl -x /dev/nvme0n1
  [...]
  Read NVMe Identify Controller failed: NVME_IOCTL_ADMIN_CMD: Inappropriate ioctl for device

The blkdev_compat_ptr_ioctl helper can be used to direct compat calls
through the main ioctl handler and makes things work again.

Fixes: 7e042cd0cf1e ("nvme: simplify the compat ioctl handling")
Signed-off-by: Nick Bowler <nbowler@draconx.ca>
Reviewed-by: Guixin Liu <kanie@linux.alibaba.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/nvme/host/core.c
drivers/nvme/host/multipath.c