Skip to contentSkip to conversation

ocfs2/security: Check xattr support in security_init.

PATCH New Tao Ma 2 participants 3 messages Feb 8, 2009 – Feb 10, 2009 OCFS2

lore
Share & tools
lore

Tao Ma

author
#0 lore raw

PATCH 1/1 ocfs2/security: Check xattr support in security_init.

If the system supports selinux, we will return sucessfully from ocfs2_init_security_get if it is called for the mount point. And in that case if the volume doesn't have xattr support, we will not be able to create a new inode in the mount dir because ocfs2_mknod will try to set security attributes for a new created inode. This patch check xattr support in ocfs2_init_security_get, so it will let ocfs2_mknod knows that we don't support xattr and it don't need to init security for the new inode in that case.

---
 fs/ocfs2/xattr.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
fs/ocfs2/xattr.c +3 -0
index 5aec833..8a7db21 100644
@@ -5289,6 +5289,9 @@ int ocfs2_init_security_get(struct inode *inode,
 			    struct inode *dir,
 			    struct ocfs2_security_xattr_info *si)
 {
+	if (!ocfs2_supports_xattr(OCFS2_SB(inode->i_sb)))
+		return -EOPNOTSUPP;
+
 	return security_inode_init_security(inode, dir, &si->name, &si->value,
 					    &si->value_len);
 }
Signature · 1 line
1.5.4.4
#1 lore raw

PATCH 1/1 ocfs2/security: Check xattr support in security_init.

Hi, Tao

I already fixed this issue :)
http://oss.oracle.com/pipermail/ocfs2-devel/2008-December/003559.html

Thanks,
tiger

Quoted 28 lines · Tao Ma

If the system supports selinux, we will return sucessfully from ocfs2_init_security_get if it is called for the mount point. And in that case if the volume doesn't have xattr support, we will not be able to create a new inode in the mount dir because ocfs2_mknod will try to set security attributes for a new created inode. This patch check xattr support in ocfs2_init_security_get, so it will let ocfs2_mknod knows that we don't support xattr and it don't need to init security for the new inode in that case.

---
 fs/ocfs2/xattr.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
fs/ocfs2/xattr.c +3 -0
index 5aec833..8a7db21 100644
@@ -5289,6 +5289,9 @@ int ocfs2_init_security_get(struct inode *inode,
 			    struct inode *dir,
 			    struct ocfs2_security_xattr_info *si)
 {
+	if (!ocfs2_supports_xattr(OCFS2_SB(inode->i_sb)))
+		return -EOPNOTSUPP;
+
 	return security_inode_init_security(inode, dir, &si->name, &si->value,
 					    &si->value_len);
 }
author
#2 lore raw

PATCH 1/1 ocfs2/security: Check xattr support in security_init.

Quoted 4 lines · Tiger Yang

Hi, Tao

I already fixed this issue :)
http://oss.oracle.com/pipermail/ocfs2-devel/2008-December/003559.html

aha, yes, It looks that my repository is a little older. Let me rebase it.

Sorry for the noise.

Regards,
Tao

Quoted 34 lines

Thanks,
tiger

Quoted 29 lines · Tao Ma

If the system supports selinux, we will return sucessfully from ocfs2_init_security_get if it is called for the mount point. And in that case if the volume doesn't have xattr support, we will not be able to create a new inode in the mount dir because ocfs2_mknod will try to set security attributes for a new created inode. This patch check xattr support in ocfs2_init_security_get, so it will let ocfs2_mknod knows that we don't support xattr and it don't need to init security for the new inode in that case.

---
 fs/ocfs2/xattr.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
fs/ocfs2/xattr.c +3 -0
index 5aec833..8a7db21 100644
@@ -5289,6 +5289,9 @@ int ocfs2_init_security_get(struct inode *inode,
                 struct inode *dir,
                 struct ocfs2_security_xattr_info *si)
 {
+    if (!ocfs2_supports_xattr(OCFS2_SB(inode->i_sb)))
+        return -EOPNOTSUPP;
+
     return security_inode_init_security(inode, dir, &si->name, 
 &si->value,
                         &si->value_len);

}