Skip to contentSkip to conversation

security: have cap_dentry_init_security return error

PATCH In review Jeff Layton 3 participants 3 messages Mar 5, 2014 – Mar 7, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 security: have cap_dentry_init_security return error

Currently, cap_dentry_init_security returns 0 without actually initializing the security label. This confuses its only caller (nfs4_label_init_security) which expects an error in that situation, and causes it to end up sending out junk onto the wire instead of simply suppressing the label in the attributes sent.

When CONFIG_SECURITY is disabled, security_dentry_init_security returns -EOPNOTSUPP. Have cap_dentry_init_security do the same.

---
 security/capability.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
security/capability.c +1 -1
index 8b4f24ae4338..9323bbeba296 100644
@@ -116,7 +116,7 @@ static int cap_dentry_init_security(struct dentry *dentry, int mode,
 					struct qstr *name, void **ctx,
 					u32 *ctxlen)
 {
-	return 0;
+	return -EOPNOTSUPP;
 }
 
 static int cap_inode_alloc_security(struct inode *inode)
Signature · 1 line
1.8.5.3
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Jeff Layton

Currently, cap_dentry_init_security returns 0 without actually initializing the security label. This confuses its only caller (nfs4_label_init_security) which expects an error in that situation, and causes it to end up sending out junk onto the wire instead of simply suppressing the label in the attributes sent.

When CONFIG_SECURITY is disabled, security_dentry_init_security returns -EOPNOTSUPP. Have cap_dentry_init_security do the same.

Quoted 20 lines
---
 security/capability.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
security/capability.c +1 -1
index 8b4f24ae4338..9323bbeba296 100644
@@ -116,7 +116,7 @@ static int cap_dentry_init_security(struct dentry *dentry, int mode,
 					struct qstr *name, void **ctx,
 					u32 *ctxlen)
 {
-	return 0;
+	return -EOPNOTSUPP;
 }
 
 static int cap_inode_alloc_security(struct inode *inode)
Signature · 1 line
1.8.5.3
maintainer
#2 lore raw
In reply to Jeff Layton
Quoted 10 lines · Jeff Layton

Currently, cap_dentry_init_security returns 0 without actually initializing the security label. This confuses its only caller (nfs4_label_init_security) which expects an error in that situation, and causes it to end up sending out junk onto the wire instead of simply suppressing the label in the attributes sent.

When CONFIG_SECURITY is disabled, security_dentry_init_security returns -EOPNOTSUPP. Have cap_dentry_init_security do the same.

Applied to
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git next

Signature · 2 lines
James Morris
<[email protected]>