mirror of https://github.com/torvalds/linux.git
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>
This commit is contained in:
parent
ca91b95001
commit
53e3e5babc
|
|
@ -633,6 +633,11 @@ smb2_get_name(const char *src, const int maxlen, struct nls_table *local_nls)
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (*name == '\0') {
|
||||||
|
kfree(name);
|
||||||
|
return ERR_PTR(-EINVAL);
|
||||||
|
}
|
||||||
|
|
||||||
if (*name == '\\') {
|
if (*name == '\\') {
|
||||||
pr_err("not allow directory name included leading slash\n");
|
pr_err("not allow directory name included leading slash\n");
|
||||||
kfree(name);
|
kfree(name);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue