Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3247618rwb; Mon, 15 Aug 2022 22:14:43 -0700 (PDT) X-Google-Smtp-Source: AA6agR4eg1VybvEGWdjTt3IrExEp7GNLT5+GnUICITvjyCwIkWtodakXd+RZzvisC4VTv5qVvj64 X-Received: by 2002:a63:cc42:0:b0:41d:c915:ffd with SMTP id q2-20020a63cc42000000b0041dc9150ffdmr16138692pgi.161.1660626882774; Mon, 15 Aug 2022 22:14:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660626882; cv=none; d=google.com; s=arc-20160816; b=vaNytYarP4yskhMjDUgr8+MbilY4aN2GyKA43mLZIY0bm4XeM2IluORSZaa0f9U+hq 15JSdnIT5hrRx3HsMKOuCrcyifwpDWRU6/lYtvG+BkA4qb6RCVkWt8LygkfNEqn0rG+E ueGMGp6U4p8ogx4/j2dgXQXQla2g16PgiJtk/3+/k6lfp4pEgOyTZQmDeZBEY5mvwmBV mp0fFR4BEcmZvhzm4LE8FzWrnNgy9dS6P54mIO83dtZIPASx5MmSZMaTiZmDsntH057D a9RtPiKXBmYQekDzhqBddKwhyQ6zc+rb0ddXxgdd/DC5NNTJVPOTwUREbDyFc8e96ZNE UUJQ== 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=oCSrj70c2yqrrIULjzX1gimXHm8DObDmq+lQ8bmwx0w=; b=efXhQ3jgdsEWtMvYZhn6r0seWXjlgB9vMqE1UGGepZm0t8f/aqUPwkiSsBg7jIOAnc 00rc6Q8nIkjX0XvM5jGN0JcYrYPLwOop/q7ikhypfWJqdBrTN7+IBaMWXZFXn0176Gh5 vLuvDtRj19+r1AMVS5KnmtVDgQ4D8CE2o8BG/Y8+VfEdZVvpqskHyrua7EAuVLTPm+Dg j1zWYFvFUUnFN46LADWhIxP6T49DI5CRjAuqb/xqO5ozJjVOgyj51ADLV+8OfUOKCp1g HeGHrQsIooMdOKPchvNggbxFZwK2i8SWx79JLzmCt3hjIqaNqDABI/Ujah/lLLbhXhnK ZRHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="yJ/wmyKJ"; 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 h10-20020a63530a000000b0042814932da7si6702037pgb.403.2022.08.15.22.14.31; Mon, 15 Aug 2022 22:14:42 -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="yJ/wmyKJ"; 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 S232536AbiHPEpi (ORCPT + 99 others); Tue, 16 Aug 2022 00:45:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231236AbiHPEmA (ORCPT ); Tue, 16 Aug 2022 00:42:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E546C4E616; Mon, 15 Aug 2022 13:36:45 -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 7B3E1611E2; Mon, 15 Aug 2022 20:36:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7FE5BC433C1; Mon, 15 Aug 2022 20:36:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660595804; bh=gMMp2Qx9M5AdLKB1yiTry430Xu/koJbBtsrhkCFPWoU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yJ/wmyKJgFfsfdYSSh5AU9dHR4ex78esPYaRS4vBoFqd/r1RbEIR5TJLrXyu/XM1h RIjsR6EcD8hWVkHhkRmThNxH834Ub3rxFCUipbIT5GdrhstTuJUJbGlHs2Qy/Jp/6v DbSD+iB3VHy6SaIfK8zXqyl2KW1gAp1VIYOHyMwg= 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.19 0881/1157] nvme: define compat_ioctl again to unbreak 32-bit userspace. Date: Mon, 15 Aug 2022 20:03:57 +0200 Message-Id: <20220815180514.671731161@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@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 6a12a906a11e..9c75d7378d31 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2123,6 +2123,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 d3e2440d8abb..432ea9793a84 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