Skip to contentSkip to conversation

selinux: drop unnecessary smp_load_acquire() call

PATCH Applied Ondrej Mosnacek 2 participants 2 messages Apr 8, 2020 – Apr 15, 2020 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selinux: drop unnecessary smp_load_acquire() call

In commit 66f8e2f03c02 ("selinux: sidtab reverse lookup hash table") the corresponding load is moved under the spin lock, so there is no race possible and we can read the count directly. The smp_store_release() is still needed to avoid racing with the lock-free readers.

---
 security/selinux/ss/sidtab.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
security/selinux/ss/sidtab.c +1 -2
index a308ce1e6a13..f90397284a57 100644
@@ -276,8 +276,7 @@ int sidtab_context_to_sid(struct sidtab *s, struct context *context,
 	if (*sid)
 		goto out_unlock;
 
-	/* read entries only after reading count */
-	count = smp_load_acquire(&s->count);
+	count = s->count;
 	convert = s->convert;
 
 	/* bail out if we already reached max entries */
Signature · 1 line
2.25.2
maintainer Applied
#1 lore raw
Quoted 10 lines · Ondrej Mosnacek

In commit 66f8e2f03c02 ("selinux: sidtab reverse lookup hash table") the corresponding load is moved under the spin lock, so there is no race possible and we can read the count directly. The smp_store_release() is still needed to avoid racing with the lock-free readers.

---
 security/selinux/ss/sidtab.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Merged into selinux/next, thanks.

Signature · 2 lines
paul moore
www.paul-moore.com