summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2020-09-24 19:41:58 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-10-14 09:46:21 +0200
commit97f8be925b061241196e78c68455914e04dc2a4b (patch)
tree8fcf72180796d778f7f387561c06dd5e58029953
parent199140bc63cd00533f1d04ce9ae72a21123530ec (diff)
ep_create_wakeup_source(): dentry name can change under you...
commit 3701cb59d892b88d569427586f01491552f377b1 upstream. or get freed, for that matter, if it's a long (separately stored) name. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/eventpoll.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 01d7ff2de17b..2ef15a4018d0 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1232,7 +1232,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) {
@@ -1241,8 +1241,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(name);
+ take_dentry_name_snapshot(&n, epi->ffd.file->f_path.dentry);
+ ws = wakeup_source_register(n.name);
+ release_dentry_name_snapshot(&n);
if (!ws)
return -ENOMEM;