Commit 1c814119 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Fix SELinux avc_log_lock

From: Stephen Smalley <sds@epoch.ncsc.mil>

This patch fixes a bug in the SELinux access vector cache code, which was
incorrectly using spin_lock_irq rather than spin_lock_irqsave for the
avc_log_lock.  As this code can be called from hardirq (e.g.  from the
file_send_sigiotask hook), we need irqsave/restore here.
parent b2967b49
...@@ -507,6 +507,7 @@ void avc_audit(u32 ssid, u32 tsid, ...@@ -507,6 +507,7 @@ void avc_audit(u32 ssid, u32 tsid,
struct inode *inode = NULL; struct inode *inode = NULL;
char *p; char *p;
u32 denied, audited; u32 denied, audited;
unsigned long flags;
denied = requested & ~avd->allowed; denied = requested & ~avd->allowed;
if (denied) { if (denied) {
...@@ -525,7 +526,7 @@ void avc_audit(u32 ssid, u32 tsid, ...@@ -525,7 +526,7 @@ void avc_audit(u32 ssid, u32 tsid,
return; return;
/* prevent overlapping printks */ /* prevent overlapping printks */
spin_lock_irq(&avc_log_lock); spin_lock_irqsave(&avc_log_lock,flags);
printk("%s\n", avc_level_string); printk("%s\n", avc_level_string);
printk("%savc: %s ", avc_level_string, denied ? "denied" : "granted"); printk("%savc: %s ", avc_level_string, denied ? "denied" : "granted");
...@@ -674,7 +675,7 @@ void avc_audit(u32 ssid, u32 tsid, ...@@ -674,7 +675,7 @@ void avc_audit(u32 ssid, u32 tsid,
avc_dump_query(ssid, tsid, tclass); avc_dump_query(ssid, tsid, tclass);
printk("\n"); printk("\n");
spin_unlock_irq(&avc_log_lock); spin_unlock_irqrestore(&avc_log_lock,flags);
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment