diff options
| author | He Wang <xw897002528@gmail.com> | 2025-01-06 03:39:54 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-01-17 13:40:44 +0100 |
| commit | 51669f4af5f7959565b48e55691ba92fabf5c587 (patch) | |
| tree | 8bb46683570abca31c063fdbd0637ffb603ce8f9 /fs/smb | |
| parent | a8d99ce66b76fe0bdc6d87e7575aaaa30b7b27a6 (diff) | |
| download | linux-51669f4af5f7959565b48e55691ba92fabf5c587.tar.gz linux-51669f4af5f7959565b48e55691ba92fabf5c587.tar.bz2 linux-51669f4af5f7959565b48e55691ba92fabf5c587.zip | |
ksmbd: fix unexpectedly changed path in ksmbd_vfs_kern_path_locked
[ Upstream commit 2ac538e40278a2c0c051cca81bcaafc547d61372 ]
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: c5a709f08d40 ("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>
Diffstat (limited to 'fs/smb')
| -rw-r--r-- | fs/smb/server/vfs.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/smb/server/vfs.c b/fs/smb/server/vfs.c index 7cbd580120d1..ee825971abd9 100644 --- a/fs/smb/server/vfs.c +++ b/fs/smb/server/vfs.c @@ -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; } |
