Skip to content

Commit

Permalink
selinux: drop unnecessary smp_load_acquire() call
Browse files Browse the repository at this point in the history
In commit 66f8e2f ("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.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
  • Loading branch information
Ondrej Mosnacek authored and Paul Moore committed Apr 15, 2020
1 parent 4b85039 commit 433e3aa
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions security/selinux/ss/sidtab.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 433e3aa

Please sign in to comment.