Skip to content

Commit

Permalink
Merge tag 'selinux-pr-20200210' of git://git.kernel.org/pub/scm/linux…
Browse files Browse the repository at this point in the history
…/kernel/git/pcmoore/selinux

Pull SELinux fixes from Paul Moore:
 "Two small fixes: one fixes a locking problem in the recently merged
  label translation code, the other fixes an embarrassing 'binderfs' /
  'binder' filesystem name check"

* tag 'selinux-pr-20200210' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux:
  selinux: fix sidtab string cache locking
  selinux: fix typo in filesystem name
  • Loading branch information
torvalds committed Feb 11, 2020
2 parents bb6d3fb + 39a706f commit a5650ac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion security/selinux/hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ static int selinux_set_mnt_opts(struct super_block *sb,

if (!strcmp(sb->s_type->name, "debugfs") ||
!strcmp(sb->s_type->name, "tracefs") ||
!strcmp(sb->s_type->name, "binderfs") ||
!strcmp(sb->s_type->name, "binder") ||
!strcmp(sb->s_type->name, "pstore"))
sbsec->flags |= SE_SBGENFS;

Expand Down
12 changes: 3 additions & 9 deletions security/selinux/ss/sidtab.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,19 +518,13 @@ void sidtab_sid2str_put(struct sidtab *s, struct sidtab_entry *entry,
const char *str, u32 str_len)
{
struct sidtab_str_cache *cache, *victim = NULL;
unsigned long flags;

/* do not cache invalid contexts */
if (entry->context.len)
return;

/*
* Skip the put operation when in non-task context to avoid the need
* to disable interrupts while holding s->cache_lock.
*/
if (!in_task())
return;

spin_lock(&s->cache_lock);
spin_lock_irqsave(&s->cache_lock, flags);

cache = rcu_dereference_protected(entry->cache,
lockdep_is_held(&s->cache_lock));
Expand Down Expand Up @@ -561,7 +555,7 @@ void sidtab_sid2str_put(struct sidtab *s, struct sidtab_entry *entry,
rcu_assign_pointer(entry->cache, cache);

out_unlock:
spin_unlock(&s->cache_lock);
spin_unlock_irqrestore(&s->cache_lock, flags);
kfree_rcu(victim, rcu_member);
}

Expand Down

0 comments on commit a5650ac

Please sign in to comment.