Skip to content

Commit 1110f6e

Browse files
Al ViroLee Jones
Al Viro
authored and
Lee Jones
committed
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 <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Lee Jones <[email protected]> Change-Id: I77685dd2416426454eb4fc8dc99bd4ae1a9bbeb8
1 parent 69b5ef7 commit 1110f6e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

fs/eventpoll.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -1236,7 +1236,7 @@ static int reverse_path_check(void)
12361236

12371237
static int ep_create_wakeup_source(struct epitem *epi)
12381238
{
1239-
const char *name;
1239+
struct name_snapshot n;
12401240
struct wakeup_source *ws;
12411241

12421242
if (!epi->ep->ws) {
@@ -1245,8 +1245,9 @@ static int ep_create_wakeup_source(struct epitem *epi)
12451245
return -ENOMEM;
12461246
}
12471247

1248-
name = epi->ffd.file->f_path.dentry->d_name.name;
1249-
ws = wakeup_source_register(name);
1248+
take_dentry_name_snapshot(&n, epi->ffd.file->f_path.dentry);
1249+
ws = wakeup_source_register(n.name);
1250+
release_dentry_name_snapshot(&n);
12501251

12511252
if (!ws)
12521253
return -ENOMEM;

0 commit comments

Comments
 (0)