* [PATCH] overlayfs: Fix setting IOP_XATTR flag
@ 2016-10-14 1:03 Andreas Gruenbacher
2016-10-14 2:49 ` Al Viro
0 siblings, 1 reply; 2+ messages in thread
From: Andreas Gruenbacher @ 2016-10-14 1:03 UTC (permalink / raw)
To: Vivek Goyal, Al Viro, Miklos Szeredi
Cc: CAI Qian, linux-fsdevel, Andreas Gruenbacher
From: Vivek Goyal <vgoyal@redhat.com>
ovl_fill_super calls ovl_new_inode to create a root inode for the new
superblock before initializing sb->s_xattr. This wrongly causes
IOP_XATTR to be cleared in i_opflags of the new inode, causing SELinux
to log the following message:
SELinux: (dev overlay, type overlay) has no xattr support
Fix this by initializing sb->s_xattr and similar fields before calling
ovl_new_inode.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
fs/overlayfs/super.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 7e3f012..0ffc8da 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -1292,6 +1292,12 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
if (!oe)
goto out_put_cred;
+ sb->s_magic = OVERLAYFS_SUPER_MAGIC;
+ sb->s_op = &ovl_super_operations;
+ sb->s_xattr = ovl_xattr_handlers;
+ sb->s_fs_info = ufs;
+ sb->s_flags |= MS_POSIXACL | MS_NOREMOTELOCK;
+
root_dentry = d_make_root(ovl_new_inode(sb, S_IFDIR));
if (!root_dentry)
goto out_free_oe;
@@ -1315,12 +1321,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
ovl_inode_init(d_inode(root_dentry), realinode, !!upperpath.dentry);
ovl_copyattr(realinode, d_inode(root_dentry));
- sb->s_magic = OVERLAYFS_SUPER_MAGIC;
- sb->s_op = &ovl_super_operations;
- sb->s_xattr = ovl_xattr_handlers;
sb->s_root = root_dentry;
- sb->s_fs_info = ufs;
- sb->s_flags |= MS_POSIXACL | MS_NOREMOTELOCK;
return 0;
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] overlayfs: Fix setting IOP_XATTR flag
2016-10-14 1:03 [PATCH] overlayfs: Fix setting IOP_XATTR flag Andreas Gruenbacher
@ 2016-10-14 2:49 ` Al Viro
0 siblings, 0 replies; 2+ messages in thread
From: Al Viro @ 2016-10-14 2:49 UTC (permalink / raw)
To: Andreas Gruenbacher; +Cc: Vivek Goyal, Miklos Szeredi, CAI Qian, linux-fsdevel
On Fri, Oct 14, 2016 at 03:03:36AM +0200, Andreas Gruenbacher wrote:
> From: Vivek Goyal <vgoyal@redhat.com>
>
> ovl_fill_super calls ovl_new_inode to create a root inode for the new
> superblock before initializing sb->s_xattr. This wrongly causes
> IOP_XATTR to be cleared in i_opflags of the new inode, causing SELinux
> to log the following message:
>
> SELinux: (dev overlay, type overlay) has no xattr support
>
> Fix this by initializing sb->s_xattr and similar fields before calling
> ovl_new_inode.
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-10-14 3:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-14 1:03 [PATCH] overlayfs: Fix setting IOP_XATTR flag Andreas Gruenbacher
2016-10-14 2:49 ` Al Viro
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).