mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/1] selinux: add the processing of the failure of avc_add_xperms_decision()
@ 2024-08-07  9:00 thunder.leizhen
  2024-08-07 14:36 ` Stephen Smalley
  2024-08-07 19:14 ` Paul Moore
  0 siblings, 2 replies; 3+ messages in thread
From: thunder.leizhen @ 2024-08-07  9:00 UTC (permalink / raw)
  To: Paul Moore, Stephen Smalley, Ondrej Mosnacek, selinux, linux-kernel
  Cc: Zhen Lei, Nick Kralevich, Jeff Vander Stoep

From: Zhen Lei <thunder.leizhen@huawei.com>

When avc_add_xperms_decision() fails, the information recorded by the new
avc node is incomplete. In this case, the new avc node should be released
instead of replacing the old avc node.

Fixes: fa1aa143ac4a ("selinux: extended permissions for ioctls")
Suggested-by: Stephen Smalley <stephen.smalley.work@gmail.com>
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 security/selinux/avc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/security/selinux/avc.c b/security/selinux/avc.c
index 7087cd2b802d8d8..b49c44869dc4627 100644
--- a/security/selinux/avc.c
+++ b/security/selinux/avc.c
@@ -907,7 +907,11 @@ static int avc_update_node(u32 event, u32 perms, u8 driver, u8 xperm, u32 ssid,
 		node->ae.avd.auditdeny &= ~perms;
 		break;
 	case AVC_CALLBACK_ADD_XPERMS:
-		avc_add_xperms_decision(node, xpd);
+		rc = avc_add_xperms_decision(node, xpd);
+		if (rc) {
+			avc_node_kill(node);
+			goto out_unlock;
+		}
 		break;
 	}
 	avc_node_replace(node, orig);
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-07 19:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-07  9:00 [PATCH 1/1] selinux: add the processing of the failure of avc_add_xperms_decision() thunder.leizhen
2024-08-07 14:36 ` Stephen Smalley
2024-08-07 19:14 ` Paul Moore

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®