diff options
Diffstat (limited to 'fs/proc')
| -rw-r--r-- | fs/proc/base.c | 14 | ||||
| -rw-r--r-- | fs/proc/generic.c | 18 | ||||
| -rw-r--r-- | fs/proc/inode.c | 14 | ||||
| -rw-r--r-- | fs/proc/namespaces.c | 8 |
4 files changed, 21 insertions, 33 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index 1485e38daaa3..03c8d747be48 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
| @@ -1151,10 +1151,16 @@ static ssize_t proc_loginuid_write(struct file * file, const char __user * buf, | |||
| 1151 | goto out_free_page; | 1151 | goto out_free_page; |
| 1152 | 1152 | ||
| 1153 | } | 1153 | } |
| 1154 | kloginuid = make_kuid(file->f_cred->user_ns, loginuid); | 1154 | |
| 1155 | if (!uid_valid(kloginuid)) { | 1155 | /* is userspace tring to explicitly UNSET the loginuid? */ |
| 1156 | length = -EINVAL; | 1156 | if (loginuid == AUDIT_UID_UNSET) { |
| 1157 | goto out_free_page; | 1157 | kloginuid = INVALID_UID; |
| 1158 | } else { | ||
| 1159 | kloginuid = make_kuid(file->f_cred->user_ns, loginuid); | ||
| 1160 | if (!uid_valid(kloginuid)) { | ||
| 1161 | length = -EINVAL; | ||
| 1162 | goto out_free_page; | ||
| 1163 | } | ||
| 1158 | } | 1164 | } |
| 1159 | 1165 | ||
| 1160 | length = audit_set_loginuid(kloginuid); | 1166 | length = audit_set_loginuid(kloginuid); |
diff --git a/fs/proc/generic.c b/fs/proc/generic.c index 737e15615b04..cca93b6fb9a9 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c | |||
| @@ -175,22 +175,6 @@ static const struct inode_operations proc_link_inode_operations = { | |||
| 175 | }; | 175 | }; |
| 176 | 176 | ||
| 177 | /* | 177 | /* |
| 178 | * As some entries in /proc are volatile, we want to | ||
| 179 | * get rid of unused dentries. This could be made | ||
| 180 | * smarter: we could keep a "volatile" flag in the | ||
| 181 | * inode to indicate which ones to keep. | ||
| 182 | */ | ||
| 183 | static int proc_delete_dentry(const struct dentry * dentry) | ||
| 184 | { | ||
| 185 | return 1; | ||
| 186 | } | ||
| 187 | |||
| 188 | static const struct dentry_operations proc_dentry_operations = | ||
| 189 | { | ||
| 190 | .d_delete = proc_delete_dentry, | ||
| 191 | }; | ||
| 192 | |||
| 193 | /* | ||
| 194 | * Don't create negative dentries here, return -ENOENT by hand | 178 | * Don't create negative dentries here, return -ENOENT by hand |
| 195 | * instead. | 179 | * instead. |
| 196 | */ | 180 | */ |
| @@ -209,7 +193,7 @@ struct dentry *proc_lookup_de(struct proc_dir_entry *de, struct inode *dir, | |||
| 209 | inode = proc_get_inode(dir->i_sb, de); | 193 | inode = proc_get_inode(dir->i_sb, de); |
| 210 | if (!inode) | 194 | if (!inode) |
| 211 | return ERR_PTR(-ENOMEM); | 195 | return ERR_PTR(-ENOMEM); |
| 212 | d_set_d_op(dentry, &proc_dentry_operations); | 196 | d_set_d_op(dentry, &simple_dentry_operations); |
| 213 | d_add(dentry, inode); | 197 | d_add(dentry, inode); |
| 214 | return NULL; | 198 | return NULL; |
| 215 | } | 199 | } |
diff --git a/fs/proc/inode.c b/fs/proc/inode.c index 28955d4b7218..124fc43c7090 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c | |||
| @@ -292,16 +292,20 @@ proc_reg_get_unmapped_area(struct file *file, unsigned long orig_addr, | |||
| 292 | { | 292 | { |
| 293 | struct proc_dir_entry *pde = PDE(file_inode(file)); | 293 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
| 294 | unsigned long rv = -EIO; | 294 | unsigned long rv = -EIO; |
| 295 | unsigned long (*get_area)(struct file *, unsigned long, unsigned long, | 295 | |
| 296 | unsigned long, unsigned long) = NULL; | ||
| 297 | if (use_pde(pde)) { | 296 | if (use_pde(pde)) { |
| 297 | typeof(proc_reg_get_unmapped_area) *get_area; | ||
| 298 | |||
| 299 | get_area = pde->proc_fops->get_unmapped_area; | ||
| 298 | #ifdef CONFIG_MMU | 300 | #ifdef CONFIG_MMU |
| 299 | get_area = current->mm->get_unmapped_area; | 301 | if (!get_area) |
| 302 | get_area = current->mm->get_unmapped_area; | ||
| 300 | #endif | 303 | #endif |
| 301 | if (pde->proc_fops->get_unmapped_area) | 304 | |
| 302 | get_area = pde->proc_fops->get_unmapped_area; | ||
| 303 | if (get_area) | 305 | if (get_area) |
| 304 | rv = get_area(file, orig_addr, len, pgoff, flags); | 306 | rv = get_area(file, orig_addr, len, pgoff, flags); |
| 307 | else | ||
| 308 | rv = orig_addr; | ||
| 305 | unuse_pde(pde); | 309 | unuse_pde(pde); |
| 306 | } | 310 | } |
| 307 | return rv; | 311 | return rv; |
diff --git a/fs/proc/namespaces.c b/fs/proc/namespaces.c index 49a7fff2e83a..9ae46b87470d 100644 --- a/fs/proc/namespaces.c +++ b/fs/proc/namespaces.c | |||
| @@ -42,12 +42,6 @@ static const struct inode_operations ns_inode_operations = { | |||
| 42 | .setattr = proc_setattr, | 42 | .setattr = proc_setattr, |
| 43 | }; | 43 | }; |
| 44 | 44 | ||
| 45 | static int ns_delete_dentry(const struct dentry *dentry) | ||
| 46 | { | ||
| 47 | /* Don't cache namespace inodes when not in use */ | ||
| 48 | return 1; | ||
| 49 | } | ||
| 50 | |||
| 51 | static char *ns_dname(struct dentry *dentry, char *buffer, int buflen) | 45 | static char *ns_dname(struct dentry *dentry, char *buffer, int buflen) |
| 52 | { | 46 | { |
| 53 | struct inode *inode = dentry->d_inode; | 47 | struct inode *inode = dentry->d_inode; |
| @@ -59,7 +53,7 @@ static char *ns_dname(struct dentry *dentry, char *buffer, int buflen) | |||
| 59 | 53 | ||
| 60 | const struct dentry_operations ns_dentry_operations = | 54 | const struct dentry_operations ns_dentry_operations = |
| 61 | { | 55 | { |
| 62 | .d_delete = ns_delete_dentry, | 56 | .d_delete = always_delete_dentry, |
| 63 | .d_dname = ns_dname, | 57 | .d_dname = ns_dname, |
| 64 | }; | 58 | }; |
| 65 | 59 | ||
