34 lines
1.0 KiB
Diff
34 lines
1.0 KiB
Diff
From 7b3f0f8d11f1b4319f593ba02d4dece890755dfa Mon Sep 17 00:00:00 2001
|
|
From: Namjae Jeon <linkinjeon@kernel.org>
|
|
Date: Wed, 30 Apr 2025 11:18:28 +0900
|
|
Subject: ksmbd: prevent rename with empty string
|
|
|
|
Client can send empty newname string to ksmbd server.
|
|
It will cause a kernel oops from d_alloc.
|
|
This patch return the error when attempting to rename
|
|
a file or directory with an empty new name string.
|
|
|
|
Cc: stable@vger.kernel.org
|
|
Reported-by: Norbert Szetei <norbert@doyensec.com>
|
|
Tested-by: Norbert Szetei <norbert@doyensec.com>
|
|
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
|
|
Signed-off-by: Steve French <stfrench@microsoft.com>
|
|
---
|
|
fs/smb/server/smb2pdu.c | 5 +++++
|
|
1 file changed, 5 insertions(+)
|
|
|
|
--- a/fs/smb/server/smb2pdu.c
|
|
+++ b/fs/smb/server/smb2pdu.c
|
|
@@ -633,6 +633,11 @@ smb2_get_name(const char *src, const int
|
|
return name;
|
|
}
|
|
|
|
+ if (*name == '\0') {
|
|
+ kfree(name);
|
|
+ return ERR_PTR(-EINVAL);
|
|
+ }
|
|
+
|
|
if (*name == '\\') {
|
|
pr_err("not allow directory name included leading slash\n");
|
|
kfree(name);
|