Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3867954pxp; Tue, 15 Mar 2022 07:52:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7imJ6H3bA7Uzdgf6+5L6e/YlAbMetKJb2BSYMG7p3KBdbkq7PpNlCEIyiR/Bg5tfdkXSC X-Received: by 2002:a17:902:bb10:b0:153:1b4b:d143 with SMTP id im16-20020a170902bb1000b001531b4bd143mr27204387plb.142.1647355932682; Tue, 15 Mar 2022 07:52:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647355932; cv=none; d=google.com; s=arc-20160816; b=vP1BoJlKrQNM3BHbwGAIgS0ADUbmyVlncwwPawdoVhQkpnLsc3nlb0cK8OPHOJbEr9 KbQwae4/8nljjRBEedZKesSfYYnL+gV9C5Y3rqdViHvFX3OynZkHIrHpE1ibQH/puapg tfM1zGgAQa5Bwk7Em5/10NjKvorfKk5mHtIA+ZWH4Jloz3/UXQivGKJg1vkiaRMOPf0+ kBnwSF+3cO0Ao8B7Jad1BDP0KNXWle25b2r+jcuYGawXVoDKkNSFWGEy6KFh4SXTVeUm OwLnoXJYloYJuoR1pBY3cuFEctdD64+KjDO24cXn1wuhp3ApDFNgzPI3TbTQrGWx5J/8 zzaQ== 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=95BVaUHr2qDll7XbMUN+UQyf3qXl3DaAeC00jsL6jKQ=; b=RADj1nkxlZX1QZxYF3vtWPetEHLuHRF1PxNKjOvJvkXVX+Nfj8jxl/oBLKD/lwY3Mh EGbf0cPGLAF0z/hDFnzwLzgCaSsR9hT3Dl7ua4G8eHrzlW24m7WIpzxm2tqfepXU2QKS 3CINiLTWUzyxC+5DYWBfdECLc08nJRgHYqLA3GE/+q+2Frsv+Pva+9dNV/zYLuuwAtOA kNzDk2MNMOkbPY/FiWFZi1nBMf0WgqA37bln/K4m2ZCqFxWkW7moYv2dAD04pF3YSphK mh5Ds76Ro/vsgd09VBqVc+WoF4n1JB6ZBXtM0I37bsC0Ug7GNZ5z8S8Esoc6vH2oTI91 96yA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=V6hxRWcg; 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 r10-20020a056a00216a00b004e1baee50dasi17985726pff.36.2022.03.15.07.51.58; Tue, 15 Mar 2022 07:52:12 -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=V6hxRWcg; 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 S244386AbiCNMcE (ORCPT + 99 others); Mon, 14 Mar 2022 08:32:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243733AbiCNMVL (ORCPT ); Mon, 14 Mar 2022 08:21:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6536B3630D; Mon, 14 Mar 2022 05:16:50 -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 DB3ED60919; Mon, 14 Mar 2022 12:16:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6598C340E9; Mon, 14 Mar 2022 12:16:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647260209; bh=46/45yPv03Vd7wdgIs0qyefA6DBhuuWV8uHgW4390cI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V6hxRWcgrI8QfXRpKMuIMf2VC6k1X7WAYwVmzvt3Mxysfwh8qXfFXjsmKrcn7vDHC WHcWj0/qZzNo88hgSatSHycrwFaFz5VHg7uX7tLeIEe8NFgQB+B5LknOc2R0frVRaL Fa9PbF7Mgqos22z8u5PA1OdFE0Xsc1sQTdjxotRo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= , Miklos Szeredi Subject: [PATCH 5.16 087/121] fuse: fix fileattr op failure Date: Mon, 14 Mar 2022 12:54:30 +0100 Message-Id: <20220314112746.547149171@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220314112744.120491875@linuxfoundation.org> References: <20220314112744.120491875@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.6 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: Miklos Szeredi commit a679a61520d8a7b0211a1da990404daf5cc80b72 upstream. The fileattr API conversion broke lsattr on ntfs3g. Previously the ioctl(... FS_IOC_GETFLAGS) returned an EINVAL error, but after the conversion the error returned by the fuse filesystem was not propagated back to the ioctl() system call, resulting in success being returned with bogus values. Fix by checking for outarg.result in fuse_priv_ioctl(), just as generic ioctl code does. Reported-by: Jean-Pierre André Fixes: 72227eac177d ("fuse: convert to fileattr") Cc: # v5.13 Signed-off-by: Miklos Szeredi Signed-off-by: Greg Kroah-Hartman --- fs/fuse/ioctl.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- a/fs/fuse/ioctl.c +++ b/fs/fuse/ioctl.c @@ -394,9 +394,12 @@ static int fuse_priv_ioctl(struct inode args.out_args[1].value = ptr; err = fuse_simple_request(fm, &args); - if (!err && outarg.flags & FUSE_IOCTL_RETRY) - err = -EIO; - + if (!err) { + if (outarg.result < 0) + err = outarg.result; + else if (outarg.flags & FUSE_IOCTL_RETRY) + err = -EIO; + } return err; }