linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] commoncap: Make cap_inode_killpriv ignore other LSM xattr
@ 2020-05-22 11:32 Dmitry Mastykin
  0 siblings, 0 replies; only message in thread
From: Dmitry Mastykin @ 2020-05-22 11:32 UTC (permalink / raw)
  Cc: dmastykin, Serge Hallyn, James Morris, linux-security-module,
	linux-kernel

Other LSM may set own capabilities to files. But its inode_killpriv
hook may not be called because cap_inode_killpriv breaks
the chain returning -ENODATA on remove xattr other than
XATTR_NAME_CAPS.

Signed-off-by: Dmitry Mastykin <dmastykin@astralinux.ru>
---
 security/commoncap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/commoncap.c b/security/commoncap.c
index f4ee0ae106b2..0c12ecf5676f 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -314,7 +314,7 @@ int cap_inode_killpriv(struct dentry *dentry)
 	int error;
 
 	error = __vfs_removexattr(dentry, XATTR_NAME_CAPS);
-	if (error == -EOPNOTSUPP)
+	if (error == -ENODATA || error == -EOPNOTSUPP)
 		error = 0;
 	return error;
 }
-- 
2.23.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-05-22 12:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-22 11:32 [PATCH] commoncap: Make cap_inode_killpriv ignore other LSM xattr Dmitry Mastykin

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).