mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	ovl: remove posix_acl_default from workdir
Clear out posix acl xattrs on workdir and also reset the mode after creation so that an inherited sgid bit is cleared. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Cc: <stable@vger.kernel.org>
This commit is contained in:
		
							parent
							
								
									38b256973e
								
							
						
					
					
						commit
						c11b9fdd6a
					
				
					 1 changed files with 19 additions and 0 deletions
				
			
		| 
						 | 
					@ -814,6 +814,10 @@ static struct dentry *ovl_workdir_create(struct vfsmount *mnt,
 | 
				
			||||||
		struct kstat stat = {
 | 
							struct kstat stat = {
 | 
				
			||||||
			.mode = S_IFDIR | 0,
 | 
								.mode = S_IFDIR | 0,
 | 
				
			||||||
		};
 | 
							};
 | 
				
			||||||
 | 
							struct iattr attr = {
 | 
				
			||||||
 | 
								.ia_valid = ATTR_MODE,
 | 
				
			||||||
 | 
								.ia_mode = stat.mode,
 | 
				
			||||||
 | 
							};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (work->d_inode) {
 | 
							if (work->d_inode) {
 | 
				
			||||||
			err = -EEXIST;
 | 
								err = -EEXIST;
 | 
				
			||||||
| 
						 | 
					@ -829,6 +833,21 @@ static struct dentry *ovl_workdir_create(struct vfsmount *mnt,
 | 
				
			||||||
		err = ovl_create_real(dir, work, &stat, NULL, NULL, true);
 | 
							err = ovl_create_real(dir, work, &stat, NULL, NULL, true);
 | 
				
			||||||
		if (err)
 | 
							if (err)
 | 
				
			||||||
			goto out_dput;
 | 
								goto out_dput;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							err = vfs_removexattr(work, XATTR_NAME_POSIX_ACL_DEFAULT);
 | 
				
			||||||
 | 
							if (err && err != -ENODATA)
 | 
				
			||||||
 | 
								goto out_dput;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							err = vfs_removexattr(work, XATTR_NAME_POSIX_ACL_ACCESS);
 | 
				
			||||||
 | 
							if (err && err != -ENODATA)
 | 
				
			||||||
 | 
								goto out_dput;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							/* Clear any inherited mode bits */
 | 
				
			||||||
 | 
							inode_lock(work->d_inode);
 | 
				
			||||||
 | 
							err = notify_change(work, &attr, NULL);
 | 
				
			||||||
 | 
							inode_unlock(work->d_inode);
 | 
				
			||||||
 | 
							if (err)
 | 
				
			||||||
 | 
								goto out_dput;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
out_unlock:
 | 
					out_unlock:
 | 
				
			||||||
	inode_unlock(dir);
 | 
						inode_unlock(dir);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue