1
0
Fork 0

ep_create_wakeup_source(): dentry name can change under you...

commit 3701cb59d8 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>
5.4-rM2-2.2.x-imx-squashed
Al Viro 2020-09-24 19:41:58 -04:00 committed by Greg Kroah-Hartman
parent 8e58bad666
commit 27423bb05e
1 changed files with 4 additions and 3 deletions

View File

@ -1453,7 +1453,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) {
@ -1462,8 +1462,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;