Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3024015rwb; Mon, 15 Aug 2022 16:21:43 -0700 (PDT) X-Google-Smtp-Source: AA6agR4dqIFGL3EyUaKReASZFtgSX+LLXqPwRJk4Ar3JzDZPq2X86As3XwkPkkrPEOG0S2jgqE5L X-Received: by 2002:a17:902:f606:b0:172:6522:4bfc with SMTP id n6-20020a170902f60600b0017265224bfcmr10332056plg.133.1660605594122; Mon, 15 Aug 2022 16:19:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605594; cv=none; d=google.com; s=arc-20160816; b=hvLKbLSG57R25D2ofElLttYSBZdLlWCWL2NBQNTumJTEzlokRW36UCvpwOKakLvV/G NjUGK9M8QV+YQuyPD/uvKwFiCaAlwq9u4xlTRb06fOD5O6kzQxlIwUO2tBOVPpKY4YkM nPEWw1BSpSVVu8zCYuD9NIQ6ENPo7QHxU+JNJgWkMaK32CVmrQx1ZS2BB/7TCgdLJLWl 9k4Z39OR0BqGBVQXKYuFJyShUBWP3JTeUxJVxp/spx0H8ZkvUjoDp8m4yNtBpJqG12oh mGEILKJ7hr9IFWp1vCGYaFVVA7QaRdMyjYa/lbeuuc+p/WXMQ7SN4Z/p7okjmwqt28TL IwwQ== 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=HR2osKbnGVVVft7gp1/IdwWe/RhTVr4BQNPGZFo6y54=; b=DDU+HswsUf4JZX1SMLO2Z2d5UbAZLj3CVz28F5zTKGbSWwYfsRUiOj3gQZk1wJlf8X Olt2DslXQSlyiTE7EpY1mIWMx59XWAGDL2gGsgPketHuzsR22flC4HSwjbu2zJsPbJlA HqurCkzbW8AHLwKhCcqNMmN9+WFQOmi1LmHmIzP9GQDCrKjaDgOF72K81PYhLZEeiDka Htvcs+YosTmMJFDfWIvqIzvjohddtONrg5eY06soJMproQrEg1yqV26COy7sMyaxaddw MtnHpb+zybk2gGoR5nft9RNO4WDjUqGuRBob3dq3ib6zX6Ha8u6T8n8WzsOIhhf2ToCw tS1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dsuOX6ws; 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 k18-20020a170902761200b00170d738f328si10829022pll.447.2022.08.15.16.19.43; Mon, 15 Aug 2022 16:19:54 -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=dsuOX6ws; 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 S1348112AbiHOW2b (ORCPT + 99 others); Mon, 15 Aug 2022 18:28:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349954AbiHOWVj (ORCPT ); Mon, 15 Aug 2022 18:21:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 694C8124F47; Mon, 15 Aug 2022 12:43:52 -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 ams.source.kernel.org (Postfix) with ESMTPS id B91F0B80EA9; Mon, 15 Aug 2022 19:43:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26AC4C4314A; Mon, 15 Aug 2022 19:43:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592629; bh=GCy6sU5OdNa/ZBPCY8OyIwcHn4s6OCqwZVqGYBE9r3E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dsuOX6wsRsDUtXyTD2kOAfN9PTJBtHYQYaBypot4d3jvSeg3WIIL8XqCtztIQri0V ffd7HiZ2AbETroSLZ/tj+cs7kS/0xe82F58xVE/vKdICI3rlzk0lSoAM7R2/MszZrd Ppgk4+s8GMT8VrvQj3XPinDUX18BXhChw926Ko4w= 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.18 0818/1095] nvme: define compat_ioctl again to unbreak 32-bit userspace. Date: Mon, 15 Aug 2022 20:03:37 +0200 Message-Id: <20220815180503.121600294@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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 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, -- 2.35.1