aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2010-04-07 15:15:25 -0400
committerJames Morris <jmorris@namei.org>2010-04-11 22:19:19 -0400
commit05b90496f2f366b9d3eea468351888ddf010782a (patch)
tree5c6b3c5167d4577043e74bb8590a6a4ed48c0bdf
parent3011a344cdcda34cdbcb40c3fb3d1a6e89954abb (diff)
security: remove dead hook acct
Unused hook. Remove. Signed-off-by: Eric Paris <eparis@redhat.com> Signed-off-by: James Morris <jmorris@namei.org>
-rw-r--r--include/linux/security.h14
-rw-r--r--kernel/acct.c20
-rw-r--r--security/capability.c6
-rw-r--r--security/security.c5
4 files changed, 5 insertions, 40 deletions
diff --git a/include/linux/security.h b/include/linux/security.h
index ac536eedec90..d670c9a3ec2b 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1254,13 +1254,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1254 * @cap contains the capability <include/linux/capability.h>. 1254 * @cap contains the capability <include/linux/capability.h>.
1255 * @audit: Whether to write an audit message or not 1255 * @audit: Whether to write an audit message or not
1256 * Return 0 if the capability is granted for @tsk. 1256 * Return 0 if the capability is granted for @tsk.
1257 * @acct:
1258 * Check permission before enabling or disabling process accounting. If
1259 * accounting is being enabled, then @file refers to the open file used to
1260 * store accounting records. If accounting is being disabled, then @file
1261 * is NULL.
1262 * @file contains the file structure for the accounting file (may be NULL).
1263 * Return 0 if permission is granted.
1264 * @sysctl: 1257 * @sysctl:
1265 * Check permission before accessing the @table sysctl variable in the 1258 * Check permission before accessing the @table sysctl variable in the
1266 * manner specified by @op. 1259 * manner specified by @op.
@@ -1383,7 +1376,6 @@ struct security_operations {
1383 const kernel_cap_t *permitted); 1376 const kernel_cap_t *permitted);
1384 int (*capable) (struct task_struct *tsk, const struct cred *cred, 1377 int (*capable) (struct task_struct *tsk, const struct cred *cred,
1385 int cap, int audit); 1378 int cap, int audit);
1386 int (*acct) (struct file *file);
1387 int (*sysctl) (struct ctl_table *table, int op); 1379 int (*sysctl) (struct ctl_table *table, int op);
1388 int (*quotactl) (int cmds, int type, int id, struct super_block *sb); 1380 int (*quotactl) (int cmds, int type, int id, struct super_block *sb);
1389 int (*quota_on) (struct dentry *dentry); 1381 int (*quota_on) (struct dentry *dentry);
@@ -1665,7 +1657,6 @@ int security_capset(struct cred *new, const struct cred *old,
1665int security_capable(int cap); 1657int security_capable(int cap);
1666int security_real_capable(struct task_struct *tsk, int cap); 1658int security_real_capable(struct task_struct *tsk, int cap);
1667int security_real_capable_noaudit(struct task_struct *tsk, int cap); 1659int security_real_capable_noaudit(struct task_struct *tsk, int cap);
1668int security_acct(struct file *file);
1669int security_sysctl(struct ctl_table *table, int op); 1660int security_sysctl(struct ctl_table *table, int op);
1670int security_quotactl(int cmds, int type, int id, struct super_block *sb); 1661int security_quotactl(int cmds, int type, int id, struct super_block *sb);
1671int security_quota_on(struct dentry *dentry); 1662int security_quota_on(struct dentry *dentry);
@@ -1883,11 +1874,6 @@ int security_real_capable_noaudit(struct task_struct *tsk, int cap)
1883 return ret; 1874 return ret;
1884} 1875}
1885 1876
1886static inline int security_acct(struct file *file)
1887{
1888 return 0;
1889}
1890
1891static inline int security_sysctl(struct ctl_table *table, int op) 1877static inline int security_sysctl(struct ctl_table *table, int op)
1892{ 1878{
1893 return 0; 1879 return 0;
diff --git a/kernel/acct.c b/kernel/acct.c
index 24f8c81fc48d..9e53bb2acfff 100644
--- a/kernel/acct.c
+++ b/kernel/acct.c
@@ -216,7 +216,6 @@ static int acct_on(char *name)
216{ 216{
217 struct file *file; 217 struct file *file;
218 struct vfsmount *mnt; 218 struct vfsmount *mnt;
219 int error;
220 struct pid_namespace *ns; 219 struct pid_namespace *ns;
221 struct bsd_acct_struct *acct = NULL; 220 struct bsd_acct_struct *acct = NULL;
222 221
@@ -244,13 +243,6 @@ static int acct_on(char *name)
244 } 243 }
245 } 244 }
246 245
247 error = security_acct(file);
248 if (error) {
249 kfree(acct);
250 filp_close(file, NULL);
251 return error;
252 }
253
254 spin_lock(&acct_lock); 246 spin_lock(&acct_lock);
255 if (ns->bacct == NULL) { 247 if (ns->bacct == NULL) {
256 ns->bacct = acct; 248 ns->bacct = acct;
@@ -281,7 +273,7 @@ static int acct_on(char *name)
281 */ 273 */
282SYSCALL_DEFINE1(acct, const char __user *, name) 274SYSCALL_DEFINE1(acct, const char __user *, name)
283{ 275{
284 int error; 276 int error = 0;
285 277
286 if (!capable(CAP_SYS_PACCT)) 278 if (!capable(CAP_SYS_PACCT))
287 return -EPERM; 279 return -EPERM;
@@ -299,13 +291,11 @@ SYSCALL_DEFINE1(acct, const char __user *, name)
299 if (acct == NULL) 291 if (acct == NULL)
300 return 0; 292 return 0;
301 293
302 error = security_acct(NULL); 294 spin_lock(&acct_lock);
303 if (!error) { 295 acct_file_reopen(acct, NULL, NULL);
304 spin_lock(&acct_lock); 296 spin_unlock(&acct_lock);
305 acct_file_reopen(acct, NULL, NULL);
306 spin_unlock(&acct_lock);
307 }
308 } 297 }
298
309 return error; 299 return error;
310} 300}
311 301
diff --git a/security/capability.c b/security/capability.c
index 8cc2b8f3b166..7f093d573ede 100644
--- a/security/capability.c
+++ b/security/capability.c
@@ -12,11 +12,6 @@
12 12
13#include <linux/security.h> 13#include <linux/security.h>
14 14
15static int cap_acct(struct file *file)
16{
17 return 0;
18}
19
20static int cap_sysctl(ctl_table *table, int op) 15static int cap_sysctl(ctl_table *table, int op)
21{ 16{
22 return 0; 17 return 0;
@@ -865,7 +860,6 @@ void security_fixup_ops(struct security_operations *ops)
865 set_to_cap_if_null(ops, ptrace_traceme); 860 set_to_cap_if_null(ops, ptrace_traceme);
866 set_to_cap_if_null(ops, capget); 861 set_to_cap_if_null(ops, capget);
867 set_to_cap_if_null(ops, capset); 862 set_to_cap_if_null(ops, capset);
868 set_to_cap_if_null(ops, acct);
869 set_to_cap_if_null(ops, capable); 863 set_to_cap_if_null(ops, capable);
870 set_to_cap_if_null(ops, quotactl); 864 set_to_cap_if_null(ops, quotactl);
871 set_to_cap_if_null(ops, quota_on); 865 set_to_cap_if_null(ops, quota_on);
diff --git a/security/security.c b/security/security.c
index 490f77753b2d..8585019a1a59 100644
--- a/security/security.c
+++ b/security/security.c
@@ -190,11 +190,6 @@ int security_real_capable_noaudit(struct task_struct *tsk, int cap)
190 return ret; 190 return ret;
191} 191}
192 192
193int security_acct(struct file *file)
194{
195 return security_ops->acct(file);
196}
197
198int security_sysctl(struct ctl_table *table, int op) 193int security_sysctl(struct ctl_table *table, int op)
199{ 194{
200 return security_ops->sysctl(table, op); 195 return security_ops->sysctl(table, op);