Skip to content

Commit 53e3e5b

Browse files
namjaejeonSteve French
authored andcommitted
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>
1 parent ca91b95 commit 53e3e5b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

fs/smb/server/smb2pdu.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,11 @@ smb2_get_name(const char *src, const int maxlen, struct nls_table *local_nls)
633633
return name;
634634
}
635635

636+
if (*name == '\0') {
637+
kfree(name);
638+
return ERR_PTR(-EINVAL);
639+
}
640+
636641
if (*name == '\\') {
637642
pr_err("not allow directory name included leading slash\n");
638643
kfree(name);

0 commit comments

Comments
 (0)