aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/base.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/proc/base.c')
-rw-r--r--fs/proc/base.c45
1 files changed, 23 insertions, 22 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 9b43ff77a51e..f3b133d79914 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -383,7 +383,7 @@ static int lstats_open(struct inode *inode, struct file *file)
383static ssize_t lstats_write(struct file *file, const char __user *buf, 383static ssize_t lstats_write(struct file *file, const char __user *buf,
384 size_t count, loff_t *offs) 384 size_t count, loff_t *offs)
385{ 385{
386 struct task_struct *task = get_proc_task(file->f_dentry->d_inode); 386 struct task_struct *task = get_proc_task(file_inode(file));
387 387
388 if (!task) 388 if (!task)
389 return -ESRCH; 389 return -ESRCH;
@@ -602,7 +602,7 @@ static const struct inode_operations proc_def_inode_operations = {
602static ssize_t proc_info_read(struct file * file, char __user * buf, 602static ssize_t proc_info_read(struct file * file, char __user * buf,
603 size_t count, loff_t *ppos) 603 size_t count, loff_t *ppos)
604{ 604{
605 struct inode * inode = file->f_path.dentry->d_inode; 605 struct inode * inode = file_inode(file);
606 unsigned long page; 606 unsigned long page;
607 ssize_t length; 607 ssize_t length;
608 struct task_struct *task = get_proc_task(inode); 608 struct task_struct *task = get_proc_task(inode);
@@ -668,7 +668,7 @@ static const struct file_operations proc_single_file_operations = {
668 668
669static int __mem_open(struct inode *inode, struct file *file, unsigned int mode) 669static int __mem_open(struct inode *inode, struct file *file, unsigned int mode)
670{ 670{
671 struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode); 671 struct task_struct *task = get_proc_task(file_inode(file));
672 struct mm_struct *mm; 672 struct mm_struct *mm;
673 673
674 if (!task) 674 if (!task)
@@ -869,7 +869,7 @@ static const struct file_operations proc_environ_operations = {
869static ssize_t oom_adj_read(struct file *file, char __user *buf, size_t count, 869static ssize_t oom_adj_read(struct file *file, char __user *buf, size_t count,
870 loff_t *ppos) 870 loff_t *ppos)
871{ 871{
872 struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode); 872 struct task_struct *task = get_proc_task(file_inode(file));
873 char buffer[PROC_NUMBUF]; 873 char buffer[PROC_NUMBUF];
874 int oom_adj = OOM_ADJUST_MIN; 874 int oom_adj = OOM_ADJUST_MIN;
875 size_t len; 875 size_t len;
@@ -916,7 +916,7 @@ static ssize_t oom_adj_write(struct file *file, const char __user *buf,
916 goto out; 916 goto out;
917 } 917 }
918 918
919 task = get_proc_task(file->f_path.dentry->d_inode); 919 task = get_proc_task(file_inode(file));
920 if (!task) { 920 if (!task) {
921 err = -ESRCH; 921 err = -ESRCH;
922 goto out; 922 goto out;
@@ -976,7 +976,7 @@ static const struct file_operations proc_oom_adj_operations = {
976static ssize_t oom_score_adj_read(struct file *file, char __user *buf, 976static ssize_t oom_score_adj_read(struct file *file, char __user *buf,
977 size_t count, loff_t *ppos) 977 size_t count, loff_t *ppos)
978{ 978{
979 struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode); 979 struct task_struct *task = get_proc_task(file_inode(file));
980 char buffer[PROC_NUMBUF]; 980 char buffer[PROC_NUMBUF];
981 short oom_score_adj = OOM_SCORE_ADJ_MIN; 981 short oom_score_adj = OOM_SCORE_ADJ_MIN;
982 unsigned long flags; 982 unsigned long flags;
@@ -1019,7 +1019,7 @@ static ssize_t oom_score_adj_write(struct file *file, const char __user *buf,
1019 goto out; 1019 goto out;
1020 } 1020 }
1021 1021
1022 task = get_proc_task(file->f_path.dentry->d_inode); 1022 task = get_proc_task(file_inode(file));
1023 if (!task) { 1023 if (!task) {
1024 err = -ESRCH; 1024 err = -ESRCH;
1025 goto out; 1025 goto out;
@@ -1067,7 +1067,7 @@ static const struct file_operations proc_oom_score_adj_operations = {
1067static ssize_t proc_loginuid_read(struct file * file, char __user * buf, 1067static ssize_t proc_loginuid_read(struct file * file, char __user * buf,
1068 size_t count, loff_t *ppos) 1068 size_t count, loff_t *ppos)
1069{ 1069{
1070 struct inode * inode = file->f_path.dentry->d_inode; 1070 struct inode * inode = file_inode(file);
1071 struct task_struct *task = get_proc_task(inode); 1071 struct task_struct *task = get_proc_task(inode);
1072 ssize_t length; 1072 ssize_t length;
1073 char tmpbuf[TMPBUFLEN]; 1073 char tmpbuf[TMPBUFLEN];
@@ -1084,7 +1084,7 @@ static ssize_t proc_loginuid_read(struct file * file, char __user * buf,
1084static ssize_t proc_loginuid_write(struct file * file, const char __user * buf, 1084static ssize_t proc_loginuid_write(struct file * file, const char __user * buf,
1085 size_t count, loff_t *ppos) 1085 size_t count, loff_t *ppos)
1086{ 1086{
1087 struct inode * inode = file->f_path.dentry->d_inode; 1087 struct inode * inode = file_inode(file);
1088 char *page, *tmp; 1088 char *page, *tmp;
1089 ssize_t length; 1089 ssize_t length;
1090 uid_t loginuid; 1090 uid_t loginuid;
@@ -1142,7 +1142,7 @@ static const struct file_operations proc_loginuid_operations = {
1142static ssize_t proc_sessionid_read(struct file * file, char __user * buf, 1142static ssize_t proc_sessionid_read(struct file * file, char __user * buf,
1143 size_t count, loff_t *ppos) 1143 size_t count, loff_t *ppos)
1144{ 1144{
1145 struct inode * inode = file->f_path.dentry->d_inode; 1145 struct inode * inode = file_inode(file);
1146 struct task_struct *task = get_proc_task(inode); 1146 struct task_struct *task = get_proc_task(inode);
1147 ssize_t length; 1147 ssize_t length;
1148 char tmpbuf[TMPBUFLEN]; 1148 char tmpbuf[TMPBUFLEN];
@@ -1165,7 +1165,7 @@ static const struct file_operations proc_sessionid_operations = {
1165static ssize_t proc_fault_inject_read(struct file * file, char __user * buf, 1165static ssize_t proc_fault_inject_read(struct file * file, char __user * buf,
1166 size_t count, loff_t *ppos) 1166 size_t count, loff_t *ppos)
1167{ 1167{
1168 struct task_struct *task = get_proc_task(file->f_dentry->d_inode); 1168 struct task_struct *task = get_proc_task(file_inode(file));
1169 char buffer[PROC_NUMBUF]; 1169 char buffer[PROC_NUMBUF];
1170 size_t len; 1170 size_t len;
1171 int make_it_fail; 1171 int make_it_fail;
@@ -1197,7 +1197,7 @@ static ssize_t proc_fault_inject_write(struct file * file,
1197 make_it_fail = simple_strtol(strstrip(buffer), &end, 0); 1197 make_it_fail = simple_strtol(strstrip(buffer), &end, 0);
1198 if (*end) 1198 if (*end)
1199 return -EINVAL; 1199 return -EINVAL;
1200 task = get_proc_task(file->f_dentry->d_inode); 1200 task = get_proc_task(file_inode(file));
1201 if (!task) 1201 if (!task)
1202 return -ESRCH; 1202 return -ESRCH;
1203 task->make_it_fail = make_it_fail; 1203 task->make_it_fail = make_it_fail;
@@ -1237,7 +1237,7 @@ static ssize_t
1237sched_write(struct file *file, const char __user *buf, 1237sched_write(struct file *file, const char __user *buf,
1238 size_t count, loff_t *offset) 1238 size_t count, loff_t *offset)
1239{ 1239{
1240 struct inode *inode = file->f_path.dentry->d_inode; 1240 struct inode *inode = file_inode(file);
1241 struct task_struct *p; 1241 struct task_struct *p;
1242 1242
1243 p = get_proc_task(inode); 1243 p = get_proc_task(inode);
@@ -1288,7 +1288,7 @@ static ssize_t
1288sched_autogroup_write(struct file *file, const char __user *buf, 1288sched_autogroup_write(struct file *file, const char __user *buf,
1289 size_t count, loff_t *offset) 1289 size_t count, loff_t *offset)
1290{ 1290{
1291 struct inode *inode = file->f_path.dentry->d_inode; 1291 struct inode *inode = file_inode(file);
1292 struct task_struct *p; 1292 struct task_struct *p;
1293 char buffer[PROC_NUMBUF]; 1293 char buffer[PROC_NUMBUF];
1294 int nice; 1294 int nice;
@@ -1343,7 +1343,7 @@ static const struct file_operations proc_pid_sched_autogroup_operations = {
1343static ssize_t comm_write(struct file *file, const char __user *buf, 1343static ssize_t comm_write(struct file *file, const char __user *buf,
1344 size_t count, loff_t *offset) 1344 size_t count, loff_t *offset)
1345{ 1345{
1346 struct inode *inode = file->f_path.dentry->d_inode; 1346 struct inode *inode = file_inode(file);
1347 struct task_struct *p; 1347 struct task_struct *p;
1348 char buffer[TASK_COMM_LEN]; 1348 char buffer[TASK_COMM_LEN];
1349 1349
@@ -1711,7 +1711,7 @@ static int map_files_d_revalidate(struct dentry *dentry, unsigned int flags)
1711 return -ECHILD; 1711 return -ECHILD;
1712 1712
1713 if (!capable(CAP_SYS_ADMIN)) { 1713 if (!capable(CAP_SYS_ADMIN)) {
1714 status = -EACCES; 1714 status = -EPERM;
1715 goto out_notask; 1715 goto out_notask;
1716 } 1716 }
1717 1717
@@ -1844,7 +1844,7 @@ static struct dentry *proc_map_files_lookup(struct inode *dir,
1844 struct dentry *result; 1844 struct dentry *result;
1845 struct mm_struct *mm; 1845 struct mm_struct *mm;
1846 1846
1847 result = ERR_PTR(-EACCES); 1847 result = ERR_PTR(-EPERM);
1848 if (!capable(CAP_SYS_ADMIN)) 1848 if (!capable(CAP_SYS_ADMIN))
1849 goto out; 1849 goto out;
1850 1850
@@ -1900,7 +1900,7 @@ proc_map_files_readdir(struct file *filp, void *dirent, filldir_t filldir)
1900 ino_t ino; 1900 ino_t ino;
1901 int ret; 1901 int ret;
1902 1902
1903 ret = -EACCES; 1903 ret = -EPERM;
1904 if (!capable(CAP_SYS_ADMIN)) 1904 if (!capable(CAP_SYS_ADMIN))
1905 goto out; 1905 goto out;
1906 1906
@@ -2146,7 +2146,7 @@ out_no_task:
2146static ssize_t proc_pid_attr_read(struct file * file, char __user * buf, 2146static ssize_t proc_pid_attr_read(struct file * file, char __user * buf,
2147 size_t count, loff_t *ppos) 2147 size_t count, loff_t *ppos)
2148{ 2148{
2149 struct inode * inode = file->f_path.dentry->d_inode; 2149 struct inode * inode = file_inode(file);
2150 char *p = NULL; 2150 char *p = NULL;
2151 ssize_t length; 2151 ssize_t length;
2152 struct task_struct *task = get_proc_task(inode); 2152 struct task_struct *task = get_proc_task(inode);
@@ -2167,7 +2167,7 @@ static ssize_t proc_pid_attr_read(struct file * file, char __user * buf,
2167static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf, 2167static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf,
2168 size_t count, loff_t *ppos) 2168 size_t count, loff_t *ppos)
2169{ 2169{
2170 struct inode * inode = file->f_path.dentry->d_inode; 2170 struct inode * inode = file_inode(file);
2171 char *page; 2171 char *page;
2172 ssize_t length; 2172 ssize_t length;
2173 struct task_struct *task = get_proc_task(inode); 2173 struct task_struct *task = get_proc_task(inode);
@@ -2256,7 +2256,7 @@ static const struct inode_operations proc_attr_dir_inode_operations = {
2256static ssize_t proc_coredump_filter_read(struct file *file, char __user *buf, 2256static ssize_t proc_coredump_filter_read(struct file *file, char __user *buf,
2257 size_t count, loff_t *ppos) 2257 size_t count, loff_t *ppos)
2258{ 2258{
2259 struct task_struct *task = get_proc_task(file->f_dentry->d_inode); 2259 struct task_struct *task = get_proc_task(file_inode(file));
2260 struct mm_struct *mm; 2260 struct mm_struct *mm;
2261 char buffer[PROC_NUMBUF]; 2261 char buffer[PROC_NUMBUF];
2262 size_t len; 2262 size_t len;
@@ -2308,7 +2308,7 @@ static ssize_t proc_coredump_filter_write(struct file *file,
2308 goto out_no_task; 2308 goto out_no_task;
2309 2309
2310 ret = -ESRCH; 2310 ret = -ESRCH;
2311 task = get_proc_task(file->f_dentry->d_inode); 2311 task = get_proc_task(file_inode(file));
2312 if (!task) 2312 if (!task)
2313 goto out_no_task; 2313 goto out_no_task;
2314 2314
@@ -2618,6 +2618,7 @@ static void proc_flush_task_mnt(struct vfsmount *mnt, pid_t pid, pid_t tgid)
2618 2618
2619 name.name = buf; 2619 name.name = buf;
2620 name.len = snprintf(buf, sizeof(buf), "%d", pid); 2620 name.len = snprintf(buf, sizeof(buf), "%d", pid);
2621 /* no ->d_hash() rejects on procfs */
2621 dentry = d_hash_and_lookup(mnt->mnt_root, &name); 2622 dentry = d_hash_and_lookup(mnt->mnt_root, &name);
2622 if (dentry) { 2623 if (dentry) {
2623 shrink_dcache_parent(dentry); 2624 shrink_dcache_parent(dentry);