ksmbd: fix unexpectedly changed path in ksmbd_vfs_kern_path_locked
[ Upstream commit2ac538e402] When `ksmbd_vfs_kern_path_locked` met an error and it is not the last entry, it will exit without restoring changed path buffer. But later this buffer may be used as the filename for creation. Fixes:c5a709f08d("ksmbd: handle caseless file creation") Signed-off-by: He Wang <xw897002528@gmail.com> Acked-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
a8d99ce66b
commit
51669f4af5
+2
-1
@@ -1264,6 +1264,8 @@ int ksmbd_vfs_kern_path_locked(struct ksmbd_work *work, char *name,
|
||||
filepath,
|
||||
flags,
|
||||
path);
|
||||
if (!is_last)
|
||||
next[0] = '/';
|
||||
if (err)
|
||||
goto out2;
|
||||
else if (is_last)
|
||||
@@ -1271,7 +1273,6 @@ int ksmbd_vfs_kern_path_locked(struct ksmbd_work *work, char *name,
|
||||
path_put(parent_path);
|
||||
*parent_path = *path;
|
||||
|
||||
next[0] = '/';
|
||||
remain_len -= filename_len + 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user