]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] sysctl: remove the proc_dir_entry member for the sysctl tables
authorEric W. Biederman <ebiederm@xmission.com>
Wed, 14 Feb 2007 08:34:14 +0000 (00:34 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Wed, 14 Feb 2007 16:10:00 +0000 (08:10 -0800)
It isn't needed anymore, all of the users are gone, and all of the ctl_table
initializers have been converted to use explicit names of the fields they are
initializing.

[akpm@osdl.org: NTFS fix]
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Cc: James Morris <jmorris@namei.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/ntfs/sysctl.c
include/linux/sysctl.h
net/decnet/dn_dev.c
net/ipv4/devinet.c
net/ipv6/addrconf.c
security/selinux/hooks.c

index 1f1ee4c9eacccee0ec768570a60f0ec5bcbae9bd..4847fbfb0107af9a687dccdd4a77f9c3690bdf02 100644 (file)
@@ -73,14 +73,6 @@ int ntfs_sysctl(int add)
                sysctls_root_table = register_sysctl_table(sysctls_root);
                if (!sysctls_root_table)
                        return -ENOMEM;
-#ifdef CONFIG_PROC_FS
-               /*
-                * If the proc filesystem is in use and we are a module, need
-                * to set the owner of our proc entry to our module. In the
-                * non-modular case, THIS_MODULE is NULL, so this is ok.
-                */
-               ntfs_sysctls[0].de->owner = THIS_MODULE;
-#endif
        } else {
                BUG_ON(!sysctls_root_table);
                unregister_sysctl_table(sysctls_root_table);
index 1371d7b86810f52019a15e81c55456844e889ee2..2c5fb38d939260909fe7f549fd9f5159acbfe868 100644 (file)
@@ -1025,7 +1025,6 @@ struct ctl_table
        ctl_table *parent;              /* Automatically set */
        proc_handler *proc_handler;     /* Callback for text formatting */
        ctl_handler *strategy;          /* Callback function for all r/w */
-       struct proc_dir_entry *de;      /* /proc control block */
        void *extra1;
        void *extra2;
 };
index 0977df42c205c60ac9f885df86a817c9137beba0..060d725e2942b909580497b2a3c7ee9c9fe8c475 100644 (file)
@@ -261,7 +261,6 @@ static void dn_dev_sysctl_register(struct net_device *dev, struct dn_dev_parms *
        for(i = 0; i < ARRAY_SIZE(t->dn_dev_vars) - 1; i++) {
                long offset = (long)t->dn_dev_vars[i].data;
                t->dn_dev_vars[i].data = ((char *)parms) + offset;
-               t->dn_dev_vars[i].de = NULL;
        }
 
        if (dev) {
@@ -273,13 +272,9 @@ static void dn_dev_sysctl_register(struct net_device *dev, struct dn_dev_parms *
        }
 
        t->dn_dev_dev[0].child = t->dn_dev_vars;
-       t->dn_dev_dev[0].de = NULL;
        t->dn_dev_conf_dir[0].child = t->dn_dev_dev;
-       t->dn_dev_conf_dir[0].de = NULL;
        t->dn_dev_proto_dir[0].child = t->dn_dev_conf_dir;
-       t->dn_dev_proto_dir[0].de = NULL;
        t->dn_dev_root_dir[0].child = t->dn_dev_proto_dir;
-       t->dn_dev_root_dir[0].de = NULL;
        t->dn_dev_vars[0].extra1 = (void *)dev;
 
        t->sysctl_header = register_sysctl_table(t->dn_dev_root_dir);
index bf3eb2dc76623af68a9b194e6466dfd7130526fe..8a0ec10a13a7370b536a63a20b6c6a4c0fd431c4 100644 (file)
@@ -1576,7 +1576,6 @@ static void devinet_sysctl_register(struct in_device *in_dev,
                return;
        for (i = 0; i < ARRAY_SIZE(t->devinet_vars) - 1; i++) {
                t->devinet_vars[i].data += (char *)p - (char *)&ipv4_devconf;
-               t->devinet_vars[i].de = NULL;
        }
 
        if (dev) {
@@ -1598,13 +1597,9 @@ static void devinet_sysctl_register(struct in_device *in_dev,
 
        t->devinet_dev[0].procname    = dev_name;
        t->devinet_dev[0].child       = t->devinet_vars;
-       t->devinet_dev[0].de          = NULL;
        t->devinet_conf_dir[0].child  = t->devinet_dev;
-       t->devinet_conf_dir[0].de     = NULL;
        t->devinet_proto_dir[0].child = t->devinet_conf_dir;
-       t->devinet_proto_dir[0].de    = NULL;
        t->devinet_root_dir[0].child  = t->devinet_proto_dir;
-       t->devinet_root_dir[0].de     = NULL;
 
        t->sysctl_header = register_sysctl_table(t->devinet_root_dir);
        if (!t->sysctl_header)
index 34d80b4aaa048364ed5db14d6583a94f897ac583..569a37d698f7711fbf2c61aad8b271cce11550c5 100644 (file)
@@ -3998,7 +3998,6 @@ static void addrconf_sysctl_register(struct inet6_dev *idev, struct ipv6_devconf
                return;
        for (i=0; t->addrconf_vars[i].data; i++) {
                t->addrconf_vars[i].data += (char*)p - (char*)&ipv6_devconf;
-               t->addrconf_vars[i].de = NULL;
                t->addrconf_vars[i].extra1 = idev; /* embedded; no ref */
        }
        if (dev) {
@@ -4021,13 +4020,9 @@ static void addrconf_sysctl_register(struct inet6_dev *idev, struct ipv6_devconf
        t->addrconf_dev[0].procname = dev_name;
 
        t->addrconf_dev[0].child = t->addrconf_vars;
-       t->addrconf_dev[0].de = NULL;
        t->addrconf_conf_dir[0].child = t->addrconf_dev;
-       t->addrconf_conf_dir[0].de = NULL;
        t->addrconf_proto_dir[0].child = t->addrconf_conf_dir;
-       t->addrconf_proto_dir[0].de = NULL;
        t->addrconf_root_dir[0].child = t->addrconf_proto_dir;
-       t->addrconf_root_dir[0].de = NULL;
 
        t->sysctl_header = register_sysctl_table(t->addrconf_root_dir);
        if (t->sysctl_header == NULL)
index 35eb8de892fc513bd187ad3c5acbce9cd271ebd1..118ddfb614eeef678bbb5803338ba1e1668ce082 100644 (file)
@@ -1423,6 +1423,41 @@ static int selinux_capable(struct task_struct *tsk, int cap)
        return task_has_capability(tsk,cap);
 }
 
+static int selinux_sysctl_get_sid(ctl_table *table, u16 tclass, u32 *sid)
+{
+       int buflen, rc;
+       char *buffer, *path, *end;
+
+       rc = -ENOMEM;
+       buffer = (char*)__get_free_page(GFP_KERNEL);
+       if (!buffer)
+               goto out;
+
+       buflen = PAGE_SIZE;
+       end = buffer+buflen;
+       *--end = '\0';
+       buflen--;
+       path = end-1;
+       *path = '/';
+       while (table) {
+               const char *name = table->procname;
+               size_t namelen = strlen(name);
+               buflen -= namelen + 1;
+               if (buflen < 0)
+                       goto out_free;
+               end -= namelen;
+               memcpy(end, name, namelen);
+               *--end = '/';
+               path = end;
+               table = table->parent;
+       }
+       rc = security_genfs_sid("proc", path, tclass, sid);
+out_free:
+       free_page((unsigned long)buffer);
+out:
+       return rc;
+}
+
 static int selinux_sysctl(ctl_table *table, int op)
 {
        int error = 0;
@@ -1437,8 +1472,8 @@ static int selinux_sysctl(ctl_table *table, int op)
 
        tsec = current->security;
 
-       rc = selinux_proc_get_sid(table->de, (op == 001) ?
-                                 SECCLASS_DIR : SECCLASS_FILE, &tsid);
+       rc = selinux_sysctl_get_sid(table, (op == 0001) ?
+                                   SECCLASS_DIR : SECCLASS_FILE, &tsid);
        if (rc) {
                /* Default to the well-defined sysctl SID. */
                tsid = SECINITSID_SYSCTL;