Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp411915pxb; Wed, 3 Mar 2021 06:30:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJwJSWUu3wXKJtzjDzH5/DInHxlZdd3M0WuoLmcp6PFPEvlYgR6aZew9SdXzVvtcMPEoQVx9 X-Received: by 2002:a17:906:a090:: with SMTP id q16mr25805980ejy.236.1614781806976; Wed, 03 Mar 2021 06:30:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614781806; cv=none; d=google.com; s=arc-20160816; b=ZYfPq3BysjdBMg56q9FyH72ktbsnmpRHBTUV4ZbFHNsmZvrFkSYpl8+yRfmeBqEZqF QSbuRtvWsc00nmaO0oNeqZWRcKKCCp07+Iz7aO11EnF3kpVmYBnCBuxHIu0uGHmM2mOf z2o3rPGxNbzs2vp+wxeMNMoLyzohCsUgHGbbsYWzE4UiVyiNic5fzULOs1CfeFde+6lL PirzQfpB6meJEzlzd6Cm3Q+Z7Qvc3na2JJ53eHw+fMv0ScUB0SRFhXHNAz6ehw/XkTPY 4mw4UV4ibRRNZSoJohHj8veOrlawYxhj+ZK+tgiDnno+8lleCBAvt30fA54eXDicoGnN woHA== 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=PjXmtV2auBiWn2rFn6x4SCj1E4gtkh9vQVOgE1pDEZg=; b=KvDyMDMBMvBxlRe5R9xOtcbbsRN+naZg9m+ef3elst59tYnxVeU3RMGOAht1Y/e2Pp SvlsMN5o4NrzkW4MEvfLq26vg9J3jII3mAiRh18XRQKMqES4r6IADjO1zpQISyqj3uh5 fXRhVu1F5K2q6y/5yL85Phzpsb16mwLmeM2+wWQCzxJ1YbQGG/yjUNVU8RwuM8yRTigK STNbDdQa1eKl5msR7vXcVuTC2iZbFS6g8Hb4stIO/CiyMbXHEcWmhZnDUmpmzvMvmZTu LiTLujcbneri0AuQ805vr4b830Uujwgtg41dYttEu2VcbkctRQxScWGwsrJv+R+5uSzO 3B/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sbG2G0mc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b3si14637847ejd.663.2021.03.03.06.29.24; Wed, 03 Mar 2021 06:30:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sbG2G0mc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S238148AbhCAV25 (ORCPT + 99 others); Mon, 1 Mar 2021 16:28:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:57230 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237934AbhCARSU (ORCPT ); Mon, 1 Mar 2021 12:18:20 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7ED1F65055; Mon, 1 Mar 2021 16:47:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614617248; bh=rUhocqEEIdLVUE1i9pREHlxKr1CjTYXHDnLqBO1x8QI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sbG2G0mc2SdXcGLYrSb7VMxlI/6lYY6c+Bpd7wKVPjS6oA69+SNIWm4rCRH1mwdyn CV7m023PbCUYnJMCN00OsAGBmmm1SvARQI6TYhy+RuGWzZUCgqMi13graiMek3j2Rt Yv4JjVEP78eDxJSf9yDcKiAIGmb2w+003IT5W/vc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Jaegeuk Kim Subject: [PATCH 4.19 229/247] f2fs: fix out-of-repair __setattr_copy() Date: Mon, 1 Mar 2021 17:14:09 +0100 Message-Id: <20210301161042.904890032@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161031.684018251@linuxfoundation.org> References: <20210301161031.684018251@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chao Yu commit 2562515f0ad7342bde6456602c491b64c63fe950 upstream. __setattr_copy() was copied from setattr_copy() in fs/attr.c, there is two missing patches doesn't cover this inner function, fix it. Commit 7fa294c8991c ("userns: Allow chown and setgid preservation") Commit 23adbe12ef7d ("fs,userns: Change inode_capable to capable_wrt_inode_uidgid") Fixes: fbfa2cc58d53 ("f2fs: add file operations") Cc: stable@vger.kernel.org Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman --- fs/f2fs/file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -760,7 +760,8 @@ static void __setattr_copy(struct inode if (ia_valid & ATTR_MODE) { umode_t mode = attr->ia_mode; - if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID)) + if (!in_group_p(inode->i_gid) && + !capable_wrt_inode_uidgid(inode, CAP_FSETID)) mode &= ~S_ISGID; set_acl_inode(inode, mode); }