Skip to content

Commit

Permalink
ep_create_wakeup_source(): dentry name can change under you...
Browse files Browse the repository at this point in the history
or get freed, for that matter, if it's a long (separately stored)
name.

Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed Sep 24, 2020
1 parent fe0a916 commit 3701cb5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions fs/eventpoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
Expand Down

0 comments on commit 3701cb5

Please sign in to comment.