Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2918286rwb; Mon, 15 Aug 2022 14:02:59 -0700 (PDT) X-Google-Smtp-Source: AA6agR6HUaKh3pQr7aedKlLJtfKnXOhS7qFr+ncbvtxDgxGcqcTvQ3zsndpjBzNACtQL5uh39ypz X-Received: by 2002:a17:90b:4653:b0:1f3:1ce3:2cb with SMTP id jw19-20020a17090b465300b001f31ce302cbmr29339608pjb.176.1660597378671; Mon, 15 Aug 2022 14:02:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660597378; cv=none; d=google.com; s=arc-20160816; b=wVnvrXosXw5we3FxCiZcAfEIHUc5bZ9R7FjUKul7ihVLuY2cPDaAMwxg2ZXUH6xH1W cuDCxgbQh0a6+TpcbmiMdGVJM3wYOuX6y/mvdgOBiFiHRYRlGRZzlUy+dw/uBR4UjmX4 rNIST7wsBmvQL7DcF8/fmY3M5hy53uGfugx33VZ/PByho1pD1wnmb4F76iN+930hBYOU nNq33ZpO07U+9lB4cy0stSHSWqKh3Xx9q1NRhaWHa0oOuMrtvM4qnhJ5B8xNxEN8Cr7m Ezcvdgsg8B9eSvYr/PRy7yAaQN3ZuLhjxoions6qaI0McnemLPapYlQEePFbjU3SggwL O+Uw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Zk2zjMriwz6nxNAmYIEABP1Bj0rQuEoKkfXOBzwGOd8=; b=qJT6HxXxPZsid69LMrAUu16uEk75meWutooKhJ6LQxcsFf1IAG/A35E+fQcShzEetZ yS/mtfF8Fz53PWotkRDFdjdpV7uvUNfSYduHDMcj+mSkILKi1wAv+nK9jo02AZhgxPbQ WkmP/o2zx5QfuCB0VwFhra7LATNFXGyWb8xcrbUHuvdqbFHWtHQPIFcEtvRaw6aP/6IT TfBLCR9NYBEZa5OKvmHCKn4CR/XVmu0jWzZ36h+W3tg/A0+NswZA2bHgTq2s/FTkAvhR YYC8NIfh9vjuGsjp9acenZtBTM+Ldwcv1skOkX18/VOZ5w4+zQr91zbx8xxqsLJj7xl5 v/UA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zsQJaPHc; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h63-20020a638342000000b0041b4079be13si153034pge.624.2022.08.15.14.02.47; Mon, 15 Aug 2022 14:02:58 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zsQJaPHc; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244093AbiHOTaI (ORCPT + 99 others); Mon, 15 Aug 2022 15:30:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343736AbiHOT0M (ORCPT ); Mon, 15 Aug 2022 15:26:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FFAF2E6A9; Mon, 15 Aug 2022 11:41:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1C19D61052; Mon, 15 Aug 2022 18:41:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DD6FC433D6; Mon, 15 Aug 2022 18:41:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588901; bh=jqZQpyPn2dZOqCwXBRjbQ/P5QFK+HXUbTUTfYyIkLK0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zsQJaPHc0jH0Ng4vNWF5v9nGM3ps7z5JlCooQX9Ojiskpl0tNNG9iJrVcktrf3v6m fIYl9HKB00ifw27s2RGxM5JJIqBiR6HojAFZfNsh4/TEY3K3wGbw7dYDcE0vod5nUK 7xrrrlTeBHbNOlKXpyi6dimfcEV0xvPZyTcKT9cw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nick Bowler , Guixin Liu , Christoph Hellwig , Jens Axboe , Sasha Levin Subject: [PATCH 5.15 550/779] nvme: define compat_ioctl again to unbreak 32-bit userspace. Date: Mon, 15 Aug 2022 20:03:14 +0200 Message-Id: <20220815180400.844968398@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: Nick Bowler [ 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 Reviewed-by: Guixin Liu Signed-off-by: Christoph Hellwig Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- 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 0c9cdbaf5cd6..ace55ebb1bff 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2102,6 +2102,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 064acad505d3..04fa276701d1 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -388,6 +388,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, -- 2.35.1