Skip to content

Commit bc7e982

Browse files
eparisLinus Torvalds
authored andcommitted
[PATCH] SELinux: convert sbsec semaphore to a mutex
This patch converts the semaphore in the superblock security struct to a mutex. No locking changes or other code changes are done. Signed-off-by: Eric Paris <eparis@redhat.com> Acked-by: Stephen Smalley <sds@tycho.nsa.gov> Acked-by: James Morris <jmorris@namei.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent 2397074 commit bc7e982

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

‎security/selinux/hooks.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
#include <net/ip.h> /* for sysctl_local_port_range[] */
5252
#include <net/tcp.h> /* struct or_callable used in sock_rcv_skb */
5353
#include <asm/uaccess.h>
54-
#include <asm/semaphore.h>
5554
#include <asm/ioctls.h>
5655
#include <linux/bitops.h>
5756
#include <linux/interrupt.h>
@@ -243,7 +242,7 @@ static int superblock_alloc_security(struct super_block *sb)
243242
if (!sbsec)
244243
return -ENOMEM;
245244

246-
init_MUTEX(&sbsec->sem);
245+
mutex_init(&sbsec->lock);
247246
INIT_LIST_HEAD(&sbsec->list);
248247
INIT_LIST_HEAD(&sbsec->isec_head);
249248
spin_lock_init(&sbsec->isec_lock);
@@ -595,7 +594,7 @@ static int superblock_doinit(struct super_block *sb, void *data)
595594
struct inode *inode = root->d_inode;
596595
int rc = 0;
597596

598-
down(&sbsec->sem);
597+
mutex_lock(&sbsec->lock);
599598
if (sbsec->initialized)
600599
goto out;
601600

@@ -690,7 +689,7 @@ static int superblock_doinit(struct super_block *sb, void *data)
690689
}
691690
spin_unlock(&sbsec->isec_lock);
692691
out:
693-
up(&sbsec->sem);
692+
mutex_unlock(&sbsec->lock);
694693
return rc;
695694
}
696695

‎security/selinux/include/objsec.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ struct superblock_security_struct {
6363
unsigned int behavior; /* labeling behavior */
6464
unsigned char initialized; /* initialization flag */
6565
unsigned char proc; /* proc fs */
66-
struct semaphore sem;
66+
struct mutex lock;
6767
struct list_head isec_head;
6868
spinlock_t isec_lock;
6969
};

0 commit comments

Comments
 (0)