Commit 38c81322 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by Arnaldo Carvalho de Melo

o X25: fix permission bogosity in create_proc_entry usage

Thanks to Al Viro for reviewing this, this also fixes the
example that made me do this copy'n'paste brain fart.
parent 45f0e972
...@@ -61,9 +61,6 @@ typedef struct wan_stat_entry ...@@ -61,9 +61,6 @@ typedef struct wan_stat_entry
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
/* Proc filesystem interface */
static int router_proc_perms(struct inode *, int);
/* Miscellaneous */ /* Miscellaneous */
/* /*
...@@ -79,11 +76,6 @@ static int router_proc_perms(struct inode *, int); ...@@ -79,11 +76,6 @@ static int router_proc_perms(struct inode *, int);
* Generic /proc/net/router/<file> file and inode operations * Generic /proc/net/router/<file> file and inode operations
*/ */
static struct inode_operations router_inode =
{
.permission = router_proc_perms,
};
/* /*
* /proc/net/router * /proc/net/router
*/ */
...@@ -98,15 +90,6 @@ static struct proc_dir_entry *proc_router; ...@@ -98,15 +90,6 @@ static struct proc_dir_entry *proc_router;
/****** Proc filesystem entry points ****************************************/ /****** Proc filesystem entry points ****************************************/
/*
* Verify access rights.
*/
static int router_proc_perms (struct inode* inode, int op)
{
return 0;
}
/* /*
* Iterator * Iterator
*/ */
...@@ -320,16 +303,14 @@ int __init wanrouter_proc_init (void) ...@@ -320,16 +303,14 @@ int __init wanrouter_proc_init (void)
if (!proc_router) if (!proc_router)
goto fail; goto fail;
p = create_proc_entry("config",0,proc_router); p = create_proc_entry("config", S_IRUGO, proc_router);
if (!p) if (!p)
goto fail_config; goto fail_config;
p->proc_fops = &config_fops; p->proc_fops = &config_fops;
p->proc_iops = &router_inode; p = create_proc_entry("status", S_IRUGO, proc_router);
p = create_proc_entry("status",0,proc_router);
if (!p) if (!p)
goto fail_stat; goto fail_stat;
p->proc_fops = &status_fops; p->proc_fops = &status_fops;
p->proc_iops = &router_inode;
return 0; return 0;
fail_stat: fail_stat:
remove_proc_entry("config", proc_router); remove_proc_entry("config", proc_router);
...@@ -359,11 +340,10 @@ int wanrouter_proc_add (wan_device_t* wandev) ...@@ -359,11 +340,10 @@ int wanrouter_proc_add (wan_device_t* wandev)
if (wandev->magic != ROUTER_MAGIC) if (wandev->magic != ROUTER_MAGIC)
return -EINVAL; return -EINVAL;
wandev->dent = create_proc_entry(wandev->name, 0, proc_router); wandev->dent = create_proc_entry(wandev->name, S_IRUGO, proc_router);
if (!wandev->dent) if (!wandev->dent)
return -ENOMEM; return -ENOMEM;
wandev->dent->proc_fops = &wandev_fops; wandev->dent->proc_fops = &wandev_fops;
wandev->dent->proc_iops = &router_inode;
wandev->dent->data = wandev; wandev->dent->data = wandev;
return 0; return 0;
} }
......
...@@ -202,15 +202,6 @@ static struct file_operations x25_seq_route_fops = { ...@@ -202,15 +202,6 @@ static struct file_operations x25_seq_route_fops = {
.release = seq_release, .release = seq_release,
}; };
static int x25_proc_perms(struct inode* inode, int op)
{
return 0;
}
static struct inode_operations x25_seq_inode = {
.permission = x25_proc_perms,
};
static struct proc_dir_entry *x25_proc_dir; static struct proc_dir_entry *x25_proc_dir;
int __init x25_proc_init(void) int __init x25_proc_init(void)
...@@ -222,17 +213,15 @@ int __init x25_proc_init(void) ...@@ -222,17 +213,15 @@ int __init x25_proc_init(void)
if (!x25_proc_dir) if (!x25_proc_dir)
goto out; goto out;
p = create_proc_entry("route", 0, x25_proc_dir); p = create_proc_entry("route", S_IRUGO, x25_proc_dir);
if (!p) if (!p)
goto out_route; goto out_route;
p->proc_fops = &x25_seq_route_fops; p->proc_fops = &x25_seq_route_fops;
p->proc_iops = &x25_seq_inode;
p = create_proc_entry("socket", 0, x25_proc_dir); p = create_proc_entry("socket", S_IRUGO, x25_proc_dir);
if (!p) if (!p)
goto out_socket; goto out_socket;
p->proc_fops = &x25_seq_socket_fops; p->proc_fops = &x25_seq_socket_fops;
p->proc_iops = &x25_seq_inode;
rc = 0; rc = 0;
out: out:
return rc; return rc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment