linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] f2fs: fix out-of-repair __setattr_copy()
@ 2020-12-16  9:15 Chao Yu
  2020-12-16  9:44 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Chao Yu @ 2020-12-16  9:15 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-f2fs-devel, linux-kernel, chao, Chao Yu, stable

__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")

Cc: stable@vger.kernel.org
Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
 fs/f2fs/file.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 16ea10f2bcf5..5bcaa68f74ad 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -848,7 +848,8 @@ static void __setattr_copy(struct inode *inode, const struct iattr *attr)
 	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);
 	}
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] f2fs: fix out-of-repair __setattr_copy()
  2020-12-16  9:15 [PATCH] f2fs: fix out-of-repair __setattr_copy() Chao Yu
@ 2020-12-16  9:44 ` Greg KH
  2020-12-17  6:51   ` Chao Yu
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2020-12-16  9:44 UTC (permalink / raw)
  To: Chao Yu; +Cc: jaegeuk, linux-f2fs-devel, linux-kernel, chao, stable

On Wed, Dec 16, 2020 at 05:15:23PM +0800, Chao Yu wrote:
> __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")

Are these lines supposed to be "Fixes:" instead of "Commit "?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] f2fs: fix out-of-repair __setattr_copy()
  2020-12-16  9:44 ` Greg KH
@ 2020-12-17  6:51   ` Chao Yu
  0 siblings, 0 replies; 3+ messages in thread
From: Chao Yu @ 2020-12-17  6:51 UTC (permalink / raw)
  To: Greg KH; +Cc: jaegeuk, linux-f2fs-devel, linux-kernel, chao, stable

On 2020/12/16 17:44, Greg KH wrote:
> On Wed, Dec 16, 2020 at 05:15:23PM +0800, Chao Yu wrote:
>> __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")
> 
> Are these lines supposed to be "Fixes:" instead of "Commit "?

IMO, the issue was introduced when f2fs module was added, and above two commits
missed to cover f2fs module... so I guess we can add Fixes line as below?

Fixes: fbfa2cc58d53 ("f2fs: add file operations")

Thanks,

> 
> thanks,
> 
> greg k-h
> .
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-12-17  6:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-16  9:15 [PATCH] f2fs: fix out-of-repair __setattr_copy() Chao Yu
2020-12-16  9:44 ` Greg KH
2020-12-17  6:51   ` Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).