aboutsummaryrefslogtreecommitdiffstats
path: root/security/smack
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-04-03 17:33:42 -0400
committerDavid S. Miller <davem@davemloft.net>2008-04-03 17:33:42 -0400
commit3bb5da3837cc1aa17736b05139c9a22c3794851a (patch)
treec92d5684a866542b1cb20641607ac1643ce03a47 /security/smack
parent7feb49c82a74bc7c091b8ab2a3f96baa33d08ece (diff)
parent9597362d354f8655ece324b01d0c640a0e99c077 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
Diffstat (limited to 'security/smack')
-rw-r--r--security/smack/smack_lsm.c14
-rw-r--r--security/smack/smackfs.c35
2 files changed, 8 insertions, 41 deletions
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index 0241fd359675..732ba27923c4 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -1117,11 +1117,6 @@ static int smack_task_movememory(struct task_struct *p)
1117static int smack_task_kill(struct task_struct *p, struct siginfo *info, 1117static int smack_task_kill(struct task_struct *p, struct siginfo *info,
1118 int sig, u32 secid) 1118 int sig, u32 secid)
1119{ 1119{
1120 int rc;
1121
1122 rc = cap_task_kill(p, info, sig, secid);
1123 if (rc != 0)
1124 return rc;
1125 /* 1120 /*
1126 * Special cases where signals really ought to go through 1121 * Special cases where signals really ought to go through
1127 * in spite of policy. Stephen Smalley suggests it may 1122 * in spite of policy. Stephen Smalley suggests it may
@@ -1508,7 +1503,7 @@ static int smack_shm_associate(struct shmid_kernel *shp, int shmflg)
1508 */ 1503 */
1509static int smack_shm_shmctl(struct shmid_kernel *shp, int cmd) 1504static int smack_shm_shmctl(struct shmid_kernel *shp, int cmd)
1510{ 1505{
1511 char *ssp = smack_of_shm(shp); 1506 char *ssp;
1512 int may; 1507 int may;
1513 1508
1514 switch (cmd) { 1509 switch (cmd) {
@@ -1532,6 +1527,7 @@ static int smack_shm_shmctl(struct shmid_kernel *shp, int cmd)
1532 return -EINVAL; 1527 return -EINVAL;
1533 } 1528 }
1534 1529
1530 ssp = smack_of_shm(shp);
1535 return smk_curacc(ssp, may); 1531 return smk_curacc(ssp, may);
1536} 1532}
1537 1533
@@ -1616,7 +1612,7 @@ static int smack_sem_associate(struct sem_array *sma, int semflg)
1616 */ 1612 */
1617static int smack_sem_semctl(struct sem_array *sma, int cmd) 1613static int smack_sem_semctl(struct sem_array *sma, int cmd)
1618{ 1614{
1619 char *ssp = smack_of_sem(sma); 1615 char *ssp;
1620 int may; 1616 int may;
1621 1617
1622 switch (cmd) { 1618 switch (cmd) {
@@ -1645,6 +1641,7 @@ static int smack_sem_semctl(struct sem_array *sma, int cmd)
1645 return -EINVAL; 1641 return -EINVAL;
1646 } 1642 }
1647 1643
1644 ssp = smack_of_sem(sma);
1648 return smk_curacc(ssp, may); 1645 return smk_curacc(ssp, may);
1649} 1646}
1650 1647
@@ -1730,7 +1727,7 @@ static int smack_msg_queue_associate(struct msg_queue *msq, int msqflg)
1730 */ 1727 */
1731static int smack_msg_queue_msgctl(struct msg_queue *msq, int cmd) 1728static int smack_msg_queue_msgctl(struct msg_queue *msq, int cmd)
1732{ 1729{
1733 char *msp = smack_of_msq(msq); 1730 char *msp;
1734 int may; 1731 int may;
1735 1732
1736 switch (cmd) { 1733 switch (cmd) {
@@ -1752,6 +1749,7 @@ static int smack_msg_queue_msgctl(struct msg_queue *msq, int cmd)
1752 return -EINVAL; 1749 return -EINVAL;
1753 } 1750 }
1754 1751
1752 msp = smack_of_msq(msq);
1755 return smk_curacc(msp, may); 1753 return smk_curacc(msp, may);
1756} 1754}
1757 1755
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
index afe7c9b0732a..cfae8afcc262 100644
--- a/security/smack/smackfs.c
+++ b/security/smack/smackfs.c
@@ -74,11 +74,6 @@ struct smk_list_entry *smack_list;
74#define SEQ_READ_FINISHED 1 74#define SEQ_READ_FINISHED 1
75 75
76/* 76/*
77 * Disable concurrent writing open() operations
78 */
79static struct semaphore smack_write_sem;
80
81/*
82 * Values for parsing cipso rules 77 * Values for parsing cipso rules
83 * SMK_DIGITLEN: Length of a digit field in a rule. 78 * SMK_DIGITLEN: Length of a digit field in a rule.
84 * SMK_CIPSOMIN: Minimum possible cipso rule length. 79 * SMK_CIPSOMIN: Minimum possible cipso rule length.
@@ -168,32 +163,7 @@ static struct seq_operations load_seq_ops = {
168 */ 163 */
169static int smk_open_load(struct inode *inode, struct file *file) 164static int smk_open_load(struct inode *inode, struct file *file)
170{ 165{
171 if ((file->f_flags & O_ACCMODE) == O_RDONLY) 166 return seq_open(file, &load_seq_ops);
172 return seq_open(file, &load_seq_ops);
173
174 if (down_interruptible(&smack_write_sem))
175 return -ERESTARTSYS;
176
177 return 0;
178}
179
180/**
181 * smk_release_load - release() for /smack/load
182 * @inode: inode structure representing file
183 * @file: "load" file pointer
184 *
185 * For a reading session, use the seq_file release
186 * implementation.
187 * Otherwise, we are at the end of a writing session so
188 * clean everything up.
189 */
190static int smk_release_load(struct inode *inode, struct file *file)
191{
192 if ((file->f_flags & O_ACCMODE) == O_RDONLY)
193 return seq_release(inode, file);
194
195 up(&smack_write_sem);
196 return 0;
197} 167}
198 168
199/** 169/**
@@ -341,7 +311,7 @@ static const struct file_operations smk_load_ops = {
341 .read = seq_read, 311 .read = seq_read,
342 .llseek = seq_lseek, 312 .llseek = seq_lseek,
343 .write = smk_write_load, 313 .write = smk_write_load,
344 .release = smk_release_load, 314 .release = seq_release,
345}; 315};
346 316
347/** 317/**
@@ -1011,7 +981,6 @@ static int __init init_smk_fs(void)
1011 } 981 }
1012 } 982 }
1013 983
1014 sema_init(&smack_write_sem, 1);
1015 smk_cipso_doi(); 984 smk_cipso_doi();
1016 smk_unlbl_ambient(NULL); 985 smk_unlbl_ambient(NULL);
1017 986