From 36fd4ef7e7c90c3139df686f36689e34c33a0478 Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Fri, 19 Oct 2007 00:44:00 -0400 Subject: [PATCH] Unionfs: fix unionfs_setattr to handle ATTR_KILL_S*ID Don't allow unionfs_setattr to trip the BUG() in notify_change. Clear ATTR_MODE if the either ATTR_KILL_S*ID is set. This also allows the lower filesystem to interpret these bits in its own way. Signed-off-by: Jeff Layton Cc: Josef 'Jeff' Sipek Cc: Christoph Hellwig Signed-off-by: Andrew Morton Signed-off-by: Erez Zadok --- fs/unionfs/inode.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/unionfs/inode.c b/fs/unionfs/inode.c index 4e59ace59b75..6ca52f4863f0 100644 --- a/fs/unionfs/inode.c +++ b/fs/unionfs/inode.c @@ -1048,6 +1048,13 @@ static int unionfs_setattr(struct dentry *dentry, struct iattr *ia) bend = dbend(dentry); inode = dentry->d_inode; + /* + * mode change is for clearing setuid/setgid. Allow lower filesystem + * to reinterpret it in its own way. + */ + if (ia->ia_valid & (ATTR_KILL_SUID | ATTR_KILL_SGID)) + ia->ia_valid &= ~ATTR_MODE; + for (bindex = bstart; (bindex <= bend) || (bindex == bstart); bindex++) { lower_dentry = unionfs_lower_dentry_idx(dentry, bindex); -- 2.43.0