aboutsummaryrefslogtreecommitdiff
path: root/fs/eventpoll.c
diff options
context:
space:
mode:
authorAl Viro2020-09-24 19:41:58 -0400
committerAl Viro2020-09-24 19:41:58 -0400
commit3701cb59d892b88d569427586f01491552f377b1 (patch)
tree237097856e005b828784aef349f3a13204e87671 /fs/eventpoll.c
parentfe0a916c1eae8e17e86c3753d13919177d63ed7e (diff)
ep_create_wakeup_source(): dentry name can change under you...
or get freed, for that matter, if it's a long (separately stored) name. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/eventpoll.c')
-rw-r--r--fs/eventpoll.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 16313180e4c1..4df61129566d 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1448,7 +1448,7 @@ static int reverse_path_check(void)
static int ep_create_wakeup_source(struct epitem *epi)
{
- const char *name;
+ struct name_snapshot n;
struct wakeup_source *ws;
if (!epi->ep->ws) {
@@ -1457,8 +1457,9 @@ static int ep_create_wakeup_source(struct epitem *epi)
return -ENOMEM;
}
- name = epi->ffd.file->f_path.dentry->d_name.name;
- ws = wakeup_source_register(NULL, name);
+ take_dentry_name_snapshot(&n, epi->ffd.file->f_path.dentry);
+ ws = wakeup_source_register(NULL, n.name.name);
+ release_dentry_name_snapshot(&n);
if (!ws)
return -ENOMEM;