Skip to content

Commit 2ac538e

Browse files
xheboxsmfrench
authored andcommitted
ksmbd: fix unexpectedly changed path in ksmbd_vfs_kern_path_locked
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: c5a709f ("ksmbd: handle caseless file creation") Signed-off-by: He Wang <[email protected]> Acked-by: Namjae Jeon <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent c7f3cd1 commit 2ac538e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/smb/server/vfs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1264,14 +1264,15 @@ int ksmbd_vfs_kern_path_locked(struct ksmbd_work *work, char *name,
12641264
filepath,
12651265
flags,
12661266
path);
1267+
if (!is_last)
1268+
next[0] = '/';
12671269
if (err)
12681270
goto out2;
12691271
else if (is_last)
12701272
goto out1;
12711273
path_put(parent_path);
12721274
*parent_path = *path;
12731275

1274-
next[0] = '/';
12751276
remain_len -= filename_len + 1;
12761277
}
12771278

0 commit comments

Comments
 (0)