Commit 580c6104 authored by Miklos Szeredi's avatar Miklos Szeredi

ovl: fix uninitialized pointer read in ovl_lookup_real_one()

One error path can result in release_dentry_name_snapshot() being called
before "name" was initialized by take_dentry_name_snapshot().

Fix by moving the release_dentry_name_snapshot() to immediately after the
only use.
Reported-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
parent 9b91b6b0
...@@ -392,6 +392,7 @@ static struct dentry *ovl_lookup_real_one(struct dentry *connected, ...@@ -392,6 +392,7 @@ static struct dentry *ovl_lookup_real_one(struct dentry *connected,
*/ */
take_dentry_name_snapshot(&name, real); take_dentry_name_snapshot(&name, real);
this = lookup_one_len(name.name.name, connected, name.name.len); this = lookup_one_len(name.name.name, connected, name.name.len);
release_dentry_name_snapshot(&name);
err = PTR_ERR(this); err = PTR_ERR(this);
if (IS_ERR(this)) { if (IS_ERR(this)) {
goto fail; goto fail;
...@@ -406,7 +407,6 @@ static struct dentry *ovl_lookup_real_one(struct dentry *connected, ...@@ -406,7 +407,6 @@ static struct dentry *ovl_lookup_real_one(struct dentry *connected,
} }
out: out:
release_dentry_name_snapshot(&name);
dput(parent); dput(parent);
inode_unlock(dir); inode_unlock(dir);
return this; return this;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment