mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 02:21:52 +09:00
ksmbd: call putname after using the last component
[ Upstream commit6fe55c2799] last component point filename struct. Currently putname is called after vfs_path_parent_lookup(). And then last component is used for lookup_one_qstr_excl(). name in last component is freed by previous calling putname(). And It cause file lookup failure when testing generic/464 test of xfstest. Fixes:74d7970feb("ksmbd: fix racy issue from using ->d_parent and ->d_name") Signed-off-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
30a1344198
commit
1524884c3e
@@ -87,12 +87,14 @@ static int ksmbd_vfs_path_lookup_locked(struct ksmbd_share_config *share_conf,
|
||||
err = vfs_path_parent_lookup(filename, flags,
|
||||
&parent_path, &last, &type,
|
||||
root_share_path);
|
||||
putname(filename);
|
||||
if (err)
|
||||
if (err) {
|
||||
putname(filename);
|
||||
return err;
|
||||
}
|
||||
|
||||
if (unlikely(type != LAST_NORM)) {
|
||||
path_put(&parent_path);
|
||||
putname(filename);
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
@@ -109,12 +111,14 @@ static int ksmbd_vfs_path_lookup_locked(struct ksmbd_share_config *share_conf,
|
||||
path->dentry = d;
|
||||
path->mnt = share_conf->vfs_path.mnt;
|
||||
path_put(&parent_path);
|
||||
putname(filename);
|
||||
|
||||
return 0;
|
||||
|
||||
err_out:
|
||||
inode_unlock(parent_path.dentry->d_inode);
|
||||
path_put(&parent_path);
|
||||
putname(filename);
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user