Closed zhanglei002 closed 3 weeks ago
Okay, Let me check it, Thanks for your report.
@zhanglei002 Can you check if the following patch fix your issue ?
diff --git a/vfs.c b/vfs.c
index 7257ba1..12f5d4d 100644
--- a/vfs.c
+++ b/vfs.c
@@ -2746,7 +2746,7 @@ static int __caseless_lookup(struct dir_context *ctx, const char *name,
if (cmp < 0)
cmp = strncasecmp((char *)buf->private, name, namlen);
if (!cmp) {
- memcpy((char *)buf->private, name, namlen);
+ memcpy((char *)buf->private, name, buf->used);
buf->dirent_count = 1;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
return false;
@@ -2823,10 +2823,7 @@ int ksmbd_vfs_kern_path_locked(struct ksmbd_work *work, char *name,
char *filepath;
size_t path_len, remain_len;
- filepath = kstrdup(name, GFP_KERNEL);
- if (!filepath)
- return -ENOMEM;
-
+ filepath = name;
path_len = strlen(filepath);
remain_len = path_len;
@@ -2869,10 +2866,9 @@ int ksmbd_vfs_kern_path_locked(struct ksmbd_work *work, char *name,
err = -EINVAL;
out2:
path_put(parent_path);
-out1:
- kfree(filepath);
}
+out1:
Thanks, the issue seems to disappear.
@zhanglei002 Let me know your e-mail address to add reported-by tag to the patch.
@zhanglei002 Let me know your e-mail address to add reported-by tag to the patch.
My e-mail address is zhanglei002@gmail.com
Added it to the patch:) Thanks for your check!
Step to reproduce:
ksmbd logs: