提交 b11afd4d 编写于 作者: A Al Viro 提交者: Yang Yingliang

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

commit 3701cb59 upstream.

or get freed, for that matter, if it's a long (separately stored)
name.
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 333582e0
...@@ -1376,7 +1376,7 @@ static int reverse_path_check(void) ...@@ -1376,7 +1376,7 @@ static int reverse_path_check(void)
static int ep_create_wakeup_source(struct epitem *epi) static int ep_create_wakeup_source(struct epitem *epi)
{ {
const char *name; struct name_snapshot n;
struct wakeup_source *ws; struct wakeup_source *ws;
if (!epi->ep->ws) { if (!epi->ep->ws) {
...@@ -1385,8 +1385,9 @@ static int ep_create_wakeup_source(struct epitem *epi) ...@@ -1385,8 +1385,9 @@ static int ep_create_wakeup_source(struct epitem *epi)
return -ENOMEM; return -ENOMEM;
} }
name = epi->ffd.file->f_path.dentry->d_name.name; take_dentry_name_snapshot(&n, epi->ffd.file->f_path.dentry);
ws = wakeup_source_register(name); ws = wakeup_source_register(n.name);
release_dentry_name_snapshot(&n);
if (!ws) if (!ws)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册