Skip to content

Commit 3701cb5

Browse files
author
Al Viro
committed
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 <[email protected]>
1 parent fe0a916 commit 3701cb5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

fs/eventpoll.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,7 +1448,7 @@ static int reverse_path_check(void)
14481448

14491449
static int ep_create_wakeup_source(struct epitem *epi)
14501450
{
1451-
const char *name;
1451+
struct name_snapshot n;
14521452
struct wakeup_source *ws;
14531453

14541454
if (!epi->ep->ws) {
@@ -1457,8 +1457,9 @@ static int ep_create_wakeup_source(struct epitem *epi)
14571457
return -ENOMEM;
14581458
}
14591459

1460-
name = epi->ffd.file->f_path.dentry->d_name.name;
1461-
ws = wakeup_source_register(NULL, name);
1460+
take_dentry_name_snapshot(&n, epi->ffd.file->f_path.dentry);
1461+
ws = wakeup_source_register(NULL, n.name.name);
1462+
release_dentry_name_snapshot(&n);
14621463

14631464
if (!ws)
14641465
return -ENOMEM;

0 commit comments

Comments
 (0)