Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp5040164imw; Tue, 19 Jul 2022 19:33:14 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tsR0Ktn5G51KbSodFU0m92vfhHMMgGKKy9Euzp7uOdHQYNbj1/Zfqt4uvUIjiT4+gy6J+4 X-Received: by 2002:a05:6402:3284:b0:43a:7fb4:ad8d with SMTP id f4-20020a056402328400b0043a7fb4ad8dmr49025945eda.28.1658284394757; Tue, 19 Jul 2022 19:33:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658284394; cv=none; d=google.com; s=arc-20160816; b=xStnTgMEjXuPnVW0Ag1xQlqx5/92hxgQnjAxdt7QP2Z88qjDuwTMI05uxLqvEL/UK5 hj0Df9AD5n4U29hlbs1gf/VWDc91Z9w/gzi6fJnozqxNA15E0tjkuxbEbwBLq/DU4453 FKivVbJGcfY40Z4/rXvmcFzY52RoTt5bT2ChlJMN0+uJJwQ+At9q4QJ1CIKy0aF/0Atc c27h6m7TWFaV5oeJtIcvyM6P9qcovEPjxpEWzmfzrmEa8BzRrjY+zJy8WSCTm37aA49m vNtzh6yUox8R510XGUpao7PaT5mWu17OAT0Me0DVeZUxAcmATw1gzJOmSblHOuQiA0Mj D/dA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=mxyDX/31+rEFMp3Wj0jrH/+seu68yiKq8MCbBmmBoO0=; b=hiz25XNRrTfGMw6J0Rfw3oSlq1C+Pu6O5rVkromcn/v8nxRgPJxgquDw+vjYHRbXTD gVT5IrGVA+HL6muxM+YamADmUbPj2M/heGcaGcPfwrtZmOcsGU8gNrdnH4GZoPIrTRPL /kfTAFYWgrfq7WVykqc8ouDz2JWXTTI9Hn6bri/uT66SEXuLOwNAsIFyqBM9U8Uwjp4r pzmqIJQtplxWfSyq5TqF1WCxeCLYw/nV4uED58awNJ0GqB8iNV8crd1IM5io39TQdX/U OqlDs00SlEnblROJOP2f43QPArAWKuvof/GtmHsRpQ3aMZVT4a5skUjn0uPonQ/5y/k6 7g7A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qb29-20020a1709077e9d00b007072f49937fsi455312ejc.452.2022.07.19.19.32.44; Tue, 19 Jul 2022 19:33:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239007AbiGTB4I (ORCPT + 99 others); Tue, 19 Jul 2022 21:56:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235626AbiGTB4H (ORCPT ); Tue, 19 Jul 2022 21:56:07 -0400 Received: from mta02.start.ca (mta02.start.ca [162.250.196.96]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D1E54D159 for ; Tue, 19 Jul 2022 18:56:05 -0700 (PDT) Received: from mta02.start.ca (localhost [127.0.0.1]) by mta02.start.ca (Postfix) with ESMTP id 33CFD41A7B; Tue, 19 Jul 2022 21:56:04 -0400 (EDT) Received: from localhost (dhcp-24-53-241-20.cable.user.start.ca [24.53.241.20]) by mta02.start.ca (Postfix) with ESMTPS id CC78F41A77; Tue, 19 Jul 2022 21:56:03 -0400 (EDT) From: Nick Bowler To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Christoph Hellwig Subject: [PATCH] nvme: Define compat_ioctl again to unbreak 32-bit userspace. Date: Tue, 19 Jul 2022 21:55:38 -0400 Message-Id: <20220720015538.15838-1-nbowler@draconx.ca> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Direct .compat_ioctl to the main ioctl handlers in order to make things work again. Fixes: 89b3d6e60550 ("nvme: simplify the compat ioctl handling") Signed-off-by: Nick Bowler --- drivers/nvme/host/core.c | 1 + drivers/nvme/host/multipath.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index a2862a56fadc..30e105dbc178 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 = nvme_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..0f38a5feec22 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 = nvme_ns_head_ioctl, .getgeo = nvme_getgeo, .report_zones = nvme_ns_head_report_zones, .pr_ops = &nvme_pr_ops, -- 2.35.1