Skip to content

Commit a5650ac

Browse files
committed
Merge tag 'selinux-pr-20200210' of git://git.kernel.org/pub/scm/linux/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
2 parents bb6d3fb + 39a706f commit a5650ac

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

security/selinux/hooks.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ static int selinux_set_mnt_opts(struct super_block *sb,
698698

699699
if (!strcmp(sb->s_type->name, "debugfs") ||
700700
!strcmp(sb->s_type->name, "tracefs") ||
701-
!strcmp(sb->s_type->name, "binderfs") ||
701+
!strcmp(sb->s_type->name, "binder") ||
702702
!strcmp(sb->s_type->name, "pstore"))
703703
sbsec->flags |= SE_SBGENFS;
704704

security/selinux/ss/sidtab.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -518,19 +518,13 @@ void sidtab_sid2str_put(struct sidtab *s, struct sidtab_entry *entry,
518518
const char *str, u32 str_len)
519519
{
520520
struct sidtab_str_cache *cache, *victim = NULL;
521+
unsigned long flags;
521522

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

526-
/*
527-
* Skip the put operation when in non-task context to avoid the need
528-
* to disable interrupts while holding s->cache_lock.
529-
*/
530-
if (!in_task())
531-
return;
532-
533-
spin_lock(&s->cache_lock);
527+
spin_lock_irqsave(&s->cache_lock, flags);
534528

535529
cache = rcu_dereference_protected(entry->cache,
536530
lockdep_is_held(&s->cache_lock));
@@ -561,7 +555,7 @@ void sidtab_sid2str_put(struct sidtab *s, struct sidtab_entry *entry,
561555
rcu_assign_pointer(entry->cache, cache);
562556

563557
out_unlock:
564-
spin_unlock(&s->cache_lock);
558+
spin_unlock_irqrestore(&s->cache_lock, flags);
565559
kfree_rcu(victim, rcu_member);
566560
}
567561

0 commit comments

Comments
 (0)