aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-11-17 10:58:42 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2015-12-08 22:41:55 -0500
commit1a384eaac265b57961c9696d9177f82eb84319e9 (patch)
tree4e2c9623fc7d03f88eb49439baa7667e0fd947eb /fs/proc
parent6a6c99049635473b64c384135a6906a10df2c916 (diff)
teach proc_self_get_link()/proc_thread_self_get_link() to work in RCU mode
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/proc')
-rw-r--r--fs/proc/self.c8
-rw-r--r--fs/proc/thread_self.c9
2 files changed, 7 insertions, 10 deletions
diff --git a/fs/proc/self.c b/fs/proc/self.c
index 9dd0ae6aefdb..7a8b19ead3b6 100644
--- a/fs/proc/self.c
+++ b/fs/proc/self.c
@@ -25,14 +25,12 @@ static const char *proc_self_get_link(struct dentry *dentry,
25 pid_t tgid = task_tgid_nr_ns(current, ns); 25 pid_t tgid = task_tgid_nr_ns(current, ns);
26 char *name; 26 char *name;
27 27
28 if (!dentry)
29 return ERR_PTR(-ECHILD);
30 if (!tgid) 28 if (!tgid)
31 return ERR_PTR(-ENOENT); 29 return ERR_PTR(-ENOENT);
32 /* 11 for max length of signed int in decimal + NULL term */ 30 /* 11 for max length of signed int in decimal + NULL term */
33 name = kmalloc(12, GFP_KERNEL); 31 name = kmalloc(12, dentry ? GFP_KERNEL : GFP_ATOMIC);
34 if (!name) 32 if (unlikely(!name))
35 return ERR_PTR(-ENOMEM); 33 return dentry ? ERR_PTR(-ENOMEM) : ERR_PTR(-ECHILD);
36 sprintf(name, "%d", tgid); 34 sprintf(name, "%d", tgid);
37 return *cookie = name; 35 return *cookie = name;
38} 36}
diff --git a/fs/proc/thread_self.c b/fs/proc/thread_self.c
index 50eef6f3e671..03eaa84604da 100644
--- a/fs/proc/thread_self.c
+++ b/fs/proc/thread_self.c
@@ -27,13 +27,12 @@ static const char *proc_thread_self_get_link(struct dentry *dentry,
27 pid_t pid = task_pid_nr_ns(current, ns); 27 pid_t pid = task_pid_nr_ns(current, ns);
28 char *name; 28 char *name;
29 29
30 if (!dentry)
31 return ERR_PTR(-ECHILD);
32 if (!pid) 30 if (!pid)
33 return ERR_PTR(-ENOENT); 31 return ERR_PTR(-ENOENT);
34 name = kmalloc(PROC_NUMBUF + 6 + PROC_NUMBUF, GFP_KERNEL); 32 name = kmalloc(PROC_NUMBUF + 6 + PROC_NUMBUF,
35 if (!name) 33 dentry ? GFP_KERNEL : GFP_ATOMIC);
36 return ERR_PTR(-ENOMEM); 34 if (unlikely(!name))
35 return dentry ? ERR_PTR(-ENOMEM) : ERR_PTR(-ECHILD);
37 sprintf(name, "%d/task/%d", tgid, pid); 36 sprintf(name, "%d/task/%d", tgid, pid);
38 return *cookie = name; 37 return *cookie = name;
39} 38}