diff options
Diffstat (limited to 'fs/proc/proc_net.c')
| -rw-r--r-- | fs/proc/proc_net.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c index d5e0fcb3439e..a7b12435519e 100644 --- a/fs/proc/proc_net.c +++ b/fs/proc/proc_net.c | |||
| @@ -38,6 +38,22 @@ static struct net *get_proc_net(const struct inode *inode) | |||
| 38 | return maybe_get_net(PDE_NET(PDE(inode))); | 38 | return maybe_get_net(PDE_NET(PDE(inode))); |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | static int proc_net_d_revalidate(struct dentry *dentry, unsigned int flags) | ||
| 42 | { | ||
| 43 | return 0; | ||
| 44 | } | ||
| 45 | |||
| 46 | static const struct dentry_operations proc_net_dentry_ops = { | ||
| 47 | .d_revalidate = proc_net_d_revalidate, | ||
| 48 | .d_delete = always_delete_dentry, | ||
| 49 | }; | ||
| 50 | |||
| 51 | static void pde_force_lookup(struct proc_dir_entry *pde) | ||
| 52 | { | ||
| 53 | /* /proc/net/ entries can be changed under us by setns(CLONE_NEWNET) */ | ||
| 54 | pde->proc_dops = &proc_net_dentry_ops; | ||
| 55 | } | ||
| 56 | |||
| 41 | static int seq_open_net(struct inode *inode, struct file *file) | 57 | static int seq_open_net(struct inode *inode, struct file *file) |
| 42 | { | 58 | { |
| 43 | unsigned int state_size = PDE(inode)->state_size; | 59 | unsigned int state_size = PDE(inode)->state_size; |
| @@ -90,6 +106,7 @@ struct proc_dir_entry *proc_create_net_data(const char *name, umode_t mode, | |||
| 90 | p = proc_create_reg(name, mode, &parent, data); | 106 | p = proc_create_reg(name, mode, &parent, data); |
| 91 | if (!p) | 107 | if (!p) |
| 92 | return NULL; | 108 | return NULL; |
| 109 | pde_force_lookup(p); | ||
| 93 | p->proc_fops = &proc_net_seq_fops; | 110 | p->proc_fops = &proc_net_seq_fops; |
| 94 | p->seq_ops = ops; | 111 | p->seq_ops = ops; |
| 95 | p->state_size = state_size; | 112 | p->state_size = state_size; |
| @@ -133,6 +150,7 @@ struct proc_dir_entry *proc_create_net_data_write(const char *name, umode_t mode | |||
| 133 | p = proc_create_reg(name, mode, &parent, data); | 150 | p = proc_create_reg(name, mode, &parent, data); |
| 134 | if (!p) | 151 | if (!p) |
| 135 | return NULL; | 152 | return NULL; |
| 153 | pde_force_lookup(p); | ||
| 136 | p->proc_fops = &proc_net_seq_fops; | 154 | p->proc_fops = &proc_net_seq_fops; |
| 137 | p->seq_ops = ops; | 155 | p->seq_ops = ops; |
| 138 | p->state_size = state_size; | 156 | p->state_size = state_size; |
| @@ -181,6 +199,7 @@ struct proc_dir_entry *proc_create_net_single(const char *name, umode_t mode, | |||
| 181 | p = proc_create_reg(name, mode, &parent, data); | 199 | p = proc_create_reg(name, mode, &parent, data); |
| 182 | if (!p) | 200 | if (!p) |
| 183 | return NULL; | 201 | return NULL; |
| 202 | pde_force_lookup(p); | ||
| 184 | p->proc_fops = &proc_net_single_fops; | 203 | p->proc_fops = &proc_net_single_fops; |
| 185 | p->single_show = show; | 204 | p->single_show = show; |
| 186 | return proc_register(parent, p); | 205 | return proc_register(parent, p); |
| @@ -223,6 +242,7 @@ struct proc_dir_entry *proc_create_net_single_write(const char *name, umode_t mo | |||
| 223 | p = proc_create_reg(name, mode, &parent, data); | 242 | p = proc_create_reg(name, mode, &parent, data); |
| 224 | if (!p) | 243 | if (!p) |
| 225 | return NULL; | 244 | return NULL; |
| 245 | pde_force_lookup(p); | ||
| 226 | p->proc_fops = &proc_net_single_fops; | 246 | p->proc_fops = &proc_net_single_fops; |
| 227 | p->single_show = show; | 247 | p->single_show = show; |
| 228 | p->write = write; | 248 | p->write = write; |
