diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2015-11-17 10:58:42 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-12-08 22:41:55 -0500 |
commit | 1a384eaac265b57961c9696d9177f82eb84319e9 (patch) | |
tree | 4e2c9623fc7d03f88eb49439baa7667e0fd947eb /fs/proc/thread_self.c | |
parent | 6a6c99049635473b64c384135a6906a10df2c916 (diff) | |
download | linux-1a384eaac265b57961c9696d9177f82eb84319e9.tar.bz2 |
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/thread_self.c')
-rw-r--r-- | fs/proc/thread_self.c | 9 |
1 files changed, 4 insertions, 5 deletions
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, pid_t pid = task_pid_nr_ns(current, ns); char *name; - if (!dentry) - return ERR_PTR(-ECHILD); if (!pid) return ERR_PTR(-ENOENT); - name = kmalloc(PROC_NUMBUF + 6 + PROC_NUMBUF, GFP_KERNEL); - if (!name) - return ERR_PTR(-ENOMEM); + name = kmalloc(PROC_NUMBUF + 6 + PROC_NUMBUF, + dentry ? GFP_KERNEL : GFP_ATOMIC); + if (unlikely(!name)) + return dentry ? ERR_PTR(-ENOMEM) : ERR_PTR(-ECHILD); sprintf(name, "%d/task/%d", tgid, pid); return *cookie = name; } |