Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3457687rwa; Tue, 23 Aug 2022 05:13:08 -0700 (PDT) X-Google-Smtp-Source: AA6agR4n5EhMnppaAzDqeCzxxmEeTpwhrvnBVzaW2YuKu6s5mhQzRCEZzQzXFDVEbgFyEd25OWCY X-Received: by 2002:aa7:c78e:0:b0:441:c311:9dcd with SMTP id n14-20020aa7c78e000000b00441c3119dcdmr3336245eds.155.1661256788016; Tue, 23 Aug 2022 05:13:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661256788; cv=none; d=google.com; s=arc-20160816; b=dJrCWE3latWyg4QbFQYKIBJyzNWlMiz2nd9nKNlgcsGIvPZ1JyaUCoaCLzJhWe4UOe wktUG80bEbjjbGOChbJBnIPa+JnCvTcR421Hx2IVODgXOdQ+lB0GbtzIda2K6pt1Y6TQ bxj62qJInfyg6D2AS9YZVw/P9veSYEOj6u1XR6uJ9vgagMJtUDElHrbn4x5EmYht+OFd vEhyb+UiORu3GTTGPgXug4qwn8rSVqHuHuwxDMSx/tZ28ttQ8OMkBXGCaoXpXkVEExx2 UeUTV/HTsVr03fx38/8QZm3DNsF5z+NQ+edhslybogvugSBxDygJXgZEUiGNTw8XTyG+ qyGw== 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=VHxMjor4d8GpBjylDL+3I9BkmbKGs3jMt7Xs0ylxwbM=; b=tt1nH0zcAWwCgsE56bNHDAlfU84I4YLjlLLmLsZsJEH6421vqdrjfMeRJ8E3y+8u7B eiR2fPXIR95XGePlGxTbx4xs1SqqBGcxMJ2aJECmrHqR8Uj38RvU5stO1ECUHNBJx9y9 X4BhCEDktt03zJ7WOZEjxJ1MrXAFVSuDtX8S/fk8G+RJ9TXbwfS6KPRU9ltdKjbSTLn2 m7V2FFuqcaSqfS13mV4fkxEASXW9I4oPo6tNAgQNTvKHXx+gXWx2/FU+RrNcn9WA1cQP jzxOSNUhG9cgJxmumfCscMbtAURwEMSoIJbUtkqSK1PdunEgcSdmsfY89BORw7sVMoIo IJ2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vAtfWQY+; 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 cs10-20020a170906dc8a00b00730672860bdsi12110751ejc.123.2022.08.23.05.12.41; Tue, 23 Aug 2022 05:13:08 -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=vAtfWQY+; 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 S1352488AbiHWKFr (ORCPT + 99 others); Tue, 23 Aug 2022 06:05:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352159AbiHWKBR (ORCPT ); Tue, 23 Aug 2022 06:01:17 -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 E40413ED63; Tue, 23 Aug 2022 01:48:49 -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 97C016122F; Tue, 23 Aug 2022 08:48:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A1E5C433D6; Tue, 23 Aug 2022 08:48:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661244528; bh=NHsKM+d4tge0A6zPGx33s14IW+dsrP40/dPudMVh+IE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vAtfWQY+aM2BhhviEkspBU89wvxGjRJpsxkkYiMSUtPb1SOhxjHvh1277qQbrn05B Iah0Hu24HU2plWvFiCF3IgOPUarKO8x4t3NcMvAFpOSl/Xw6gHDeedzOfBCiLLZ8va skl8bXXClhteRYHEDe+oDuxu9E2dJKWvBtuYJ8DQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konstantin Komarov Subject: [PATCH 5.15 107/244] fs/ntfs3: Do not change mode if ntfs_set_ea failed Date: Tue, 23 Aug 2022 10:24:26 +0200 Message-Id: <20220823080102.591453799@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080059.091088642@linuxfoundation.org> References: <20220823080059.091088642@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: Konstantin Komarov commit 460bbf2990b3fdc597601c2cf669a3371c069242 upstream. ntfs_set_ea can fail with NOSPC, so we don't need to change mode in this situation. Fixes xfstest generic/449 Fixes: be71b5cba2e6 ("fs/ntfs3: Add attrib operations") Signed-off-by: Konstantin Komarov Signed-off-by: Greg Kroah-Hartman --- fs/ntfs3/xattr.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) --- a/fs/ntfs3/xattr.c +++ b/fs/ntfs3/xattr.c @@ -545,28 +545,23 @@ static noinline int ntfs_set_acl_ex(stru { const char *name; size_t size, name_len; - void *value = NULL; - int err = 0; + void *value; + int err; int flags; + umode_t mode; if (S_ISLNK(inode->i_mode)) return -EOPNOTSUPP; + mode = inode->i_mode; switch (type) { case ACL_TYPE_ACCESS: /* Do not change i_mode if we are in init_acl */ if (acl && !init_acl) { - umode_t mode; - err = posix_acl_update_mode(mnt_userns, inode, &mode, &acl); if (err) goto out; - - if (inode->i_mode != mode) { - inode->i_mode = mode; - mark_inode_dirty(inode); - } } name = XATTR_NAME_POSIX_ACL_ACCESS; name_len = sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1; @@ -602,8 +597,13 @@ static noinline int ntfs_set_acl_ex(stru err = ntfs_set_ea(inode, name, name_len, value, size, flags); if (err == -ENODATA && !size) err = 0; /* Removing non existed xattr. */ - if (!err) + if (!err) { set_cached_acl(inode, type, acl); + if (inode->i_mode != mode) { + inode->i_mode = mode; + mark_inode_dirty(inode); + } + } out: kfree(value);