lkml.org 
[lkml]   [2016]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] Re: Problem with setxattr on sockfs with Smack after 971df15bd54ad46e907046ff33750a137b2f0096
Date
Casey,

does this patch help?

(The way how security xattrs are handled by LSM is pretty ugly. I'm not
convinced that it doesn't break something else, yet.)

Thanks,
Andreas
---
fs/xattr.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/fs/xattr.c b/fs/xattr.c
index 3368659..bf09836 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -183,11 +183,13 @@ int __vfs_setxattr_noperm(struct dentry *dentry, const char *name,
security_inode_post_setxattr(dentry, name, value,
size, flags);
}
- } else if (issec) {
- const char *suffix = name + XATTR_SECURITY_PREFIX_LEN;
-
+ } else {
if (unlikely(is_bad_inode(inode)))
return -EIO;
+ }
+ if (issec && error == -EOPNOTSUPP) {
+ const char *suffix = name + XATTR_SECURITY_PREFIX_LEN;
+
error = security_inode_setsecurity(inode, suffix, value,
size, flags);
if (!error)
--
2.7.4
\
 
 \ /
  Last update: 2016-11-02 20:35    [W:0.145 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site