Patch "nvme: define compat_ioctl again to unbreak 32-bit userspace." has been added to the 5.18-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    nvme: define compat_ioctl again to unbreak 32-bit userspace.

to the 5.18-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-define-compat_ioctl-again-to-unbreak-32-bit-use.patch
and it can be found in the queue-5.18 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 931d06cdae350edaac1191fc026a9ca962360501
Author: Nick Bowler <nbowler@xxxxxxxxxx>
Date:   Wed Jul 20 23:57:35 2022 -0400

    nvme: define compat_ioctl again to unbreak 32-bit userspace.
    
    [ Upstream commit a25d4261582cf00dad884c194d21084836663d3d ]
    
    Commit 89b3d6e60550 ("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: 89b3d6e60550 ("nvme: simplify the compat ioctl handling")
    Signed-off-by: Nick Bowler <nbowler@xxxxxxxxxx>
    Reviewed-by: Guixin Liu <kanie@xxxxxxxxxxxxxxxxx>
    Signed-off-by: Christoph Hellwig <hch@xxxxxx>
    Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index c9831daafbc6..cf7be9b4f5d3 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2093,6 +2093,7 @@ static int nvme_report_zones(struct gendisk *disk, sector_t sector,
 static const struct block_device_operations nvme_bdev_ops = {
 	.owner		= THIS_MODULE,
 	.ioctl		= nvme_ioctl,
+	.compat_ioctl	= blkdev_compat_ptr_ioctl,
 	.open		= nvme_open,
 	.release	= nvme_release,
 	.getgeo		= nvme_getgeo,
diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index d464fdf978fb..b0fe23439c4a 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -408,6 +408,7 @@ const struct block_device_operations nvme_ns_head_ops = {
 	.open		= nvme_ns_head_open,
 	.release	= nvme_ns_head_release,
 	.ioctl		= nvme_ns_head_ioctl,
+	.compat_ioctl	= blkdev_compat_ptr_ioctl,
 	.getgeo		= nvme_getgeo,
 	.report_zones	= nvme_ns_head_report_zones,
 	.pr_ops		= &nvme_pr_ops,



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux