ovl: fix uninitialized pointer read in ovl_lookup_real_one()
[ Upstream commit 580c610429
]
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: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
c94d50979f
commit
ef2d68ef9a
@ -390,6 +390,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;
|
||||||
@ -404,7 +405,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;
|
||||||
|
Reference in New Issue
Block a user