From b8aa8fc51b2223cdd8e495275c447baee20ad4aa Mon Sep 17 00:00:00 2001 From: James Morris Date: Fri, 6 Jun 2008 18:50:12 +1000 Subject: [PATCH] --- yaml --- r: 99209 b: refs/heads/master c: bdd581c1439339f1d3e8446b83e0f1beaef294e9 h: refs/heads/master i: 99207: f03ff6c1fb2615260a9d81eb6fe8129cbd7b2e9d v: v3 --- [refs] | 2 +- trunk/security/selinux/ss/sidtab.c | 18 +++++++----------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/[refs] b/[refs] index ce5204852c85..48ed2de75660 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 972ccac2b237967ed7e56a50eb181b5a0a484b79 +refs/heads/master: bdd581c1439339f1d3e8446b83e0f1beaef294e9 diff --git a/trunk/security/selinux/ss/sidtab.c b/trunk/security/selinux/ss/sidtab.c index ba3541640491..a81ded104129 100644 --- a/trunk/security/selinux/ss/sidtab.c +++ b/trunk/security/selinux/ss/sidtab.c @@ -14,10 +14,6 @@ #define SIDTAB_HASH(sid) \ (sid & SIDTAB_HASH_MASK) -#define INIT_SIDTAB_LOCK(s) spin_lock_init(&s->lock) -#define SIDTAB_LOCK(s, x) spin_lock_irqsave(&s->lock, x) -#define SIDTAB_UNLOCK(s, x) spin_unlock_irqrestore(&s->lock, x) - int sidtab_init(struct sidtab *s) { int i; @@ -30,7 +26,7 @@ int sidtab_init(struct sidtab *s) s->nel = 0; s->next_sid = 1; s->shutdown = 0; - INIT_SIDTAB_LOCK(s); + spin_lock_init(&s->lock); return 0; } @@ -180,7 +176,7 @@ int sidtab_context_to_sid(struct sidtab *s, sid = sidtab_search_context(s, context); if (!sid) { - SIDTAB_LOCK(s, flags); + spin_lock_irqsave(&s->lock, flags); /* Rescan now that we hold the lock. */ sid = sidtab_search_context(s, context); if (sid) @@ -199,7 +195,7 @@ int sidtab_context_to_sid(struct sidtab *s, if (ret) s->next_sid--; unlock_out: - SIDTAB_UNLOCK(s, flags); + spin_unlock_irqrestore(&s->lock, flags); } if (ret) @@ -264,19 +260,19 @@ void sidtab_set(struct sidtab *dst, struct sidtab *src) { unsigned long flags; - SIDTAB_LOCK(src, flags); + spin_lock_irqsave(&src->lock, flags); dst->htable = src->htable; dst->nel = src->nel; dst->next_sid = src->next_sid; dst->shutdown = 0; - SIDTAB_UNLOCK(src, flags); + spin_unlock_irqrestore(&src->lock, flags); } void sidtab_shutdown(struct sidtab *s) { unsigned long flags; - SIDTAB_LOCK(s, flags); + spin_lock_irqsave(&s->lock, flags); s->shutdown = 1; - SIDTAB_UNLOCK(s, flags); + spin_unlock_irqrestore(&s->lock, flags); }