summaryrefslogtreecommitdiff
path: root/fs/proc/self.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-11-17 18:58:42 +0300
committerAl Viro <viro@zeniv.linux.org.uk>2015-12-09 06:41:55 +0300
commit1a384eaac265b57961c9696d9177f82eb84319e9 (patch)
tree4e2c9623fc7d03f88eb49439baa7667e0fd947eb /fs/proc/self.c
parent6a6c99049635473b64c384135a6906a10df2c916 (diff)
downloadlinux-1a384eaac265b57961c9696d9177f82eb84319e9.tar.xz
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/self.c')
-rw-r--r--fs/proc/self.c8
1 files changed, 3 insertions, 5 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,
pid_t tgid = task_tgid_nr_ns(current, ns);
char *name;
- if (!dentry)
- return ERR_PTR(-ECHILD);
if (!tgid)
return ERR_PTR(-ENOENT);
/* 11 for max length of signed int in decimal + NULL term */
- name = kmalloc(12, GFP_KERNEL);
- if (!name)
- return ERR_PTR(-ENOMEM);
+ name = kmalloc(12, dentry ? GFP_KERNEL : GFP_ATOMIC);
+ if (unlikely(!name))
+ return dentry ? ERR_PTR(-ENOMEM) : ERR_PTR(-ECHILD);
sprintf(name, "%d", tgid);
return *cookie = name;
}