Skip to contentSkip to conversation

SELinux: Remove excessive interrupt disablement

PATCH In review David Howells 2 participants 2 messages Apr 29, 2009 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 SELinux: Remove excessive interrupt disablement

There's no need to disable interrupts with spin_lock_irqsave() inside of read_lock_irq().

---

 security/selinux/hooks.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
security/selinux/hooks.c +2 -3
index ba808ef..0702ba6 100644
@@ -2378,7 +2378,6 @@ static void selinux_bprm_committed_creds(struct linux_binprm *bprm)
 	struct sighand_struct *psig;
 	u32 osid, sid;
 	int rc, i;
-	unsigned long flags;
 
 	osid = tsec->osid;
 	sid = tsec->sid;
@@ -2410,9 +2409,9 @@ static void selinux_bprm_committed_creds(struct linux_binprm *bprm)
 	 * wait permission to the new task SID. */
 	read_lock_irq(&tasklist_lock);
 	psig = current->parent->sighand;
-	spin_lock_irqsave(&psig->siglock, flags);
+	spin_lock(&psig->siglock);
 	wake_up_interruptible(&current->parent->signal->wait_chldexit);
-	spin_unlock_irqrestore(&psig->siglock, flags);
+	spin_unlock(&psig->siglock);
 	read_unlock_irq(&tasklist_lock);
 }
 
#1 lore raw

security/selinux/hooks.c static void selinux_bprm_committed_creds(struct linux_binprm *bprm) · line 2410

Quoted 4 lines · David Howells
security/selinux/hooks.c +0 -0
@@ -2410,9 +2409,9 @@ static void selinux_bprm_committed_creds(struct linux_binprm *bprm)
 	 * wait permission to the new task SID. */
 	read_lock_irq(&tasklist_lock);

_irq is not needed, just read_lock(&tasklist_lock) should be fine.

security/selinux/hooks.c static void selinux_bprm_committed_creds(struct linux_binprm *bprm) · line 2412

Quoted 3 lines
security/selinux/hooks.c +1 -1
 	psig = current->parent->sighand;
-	spin_lock_irqsave(&psig->siglock, flags);
+	spin_lock(&psig->siglock);

I think we don't need ->siglock at all.

security/selinux/hooks.c static void selinux_bprm_committed_creds(struct linux_binprm *bprm) · line 2413

Quoted 1 line
security/selinux/hooks.c +0 -0
 	wake_up_interruptible(&current->parent->signal->wait_chldexit);

off-topic wrt this patch, but I believe we need

	__wake_up_parent(curremt, current->real_parent);

Oleg.