提交 ed8dbc7b 编写于 作者: E Eugene Korenevsky 提交者: Zheng Zengkai

cifs: fix out-of-bound memory access when calling smb3_notify() at mount point

stable inclusion
from stable-5.10.36
commit 23d7b4a8f77ae1252ac1a0c496ec3b603f85f593
bugzilla: 51867
CVE: NA

--------------------------------

commit a637f4ae upstream.

If smb3_notify() is called at mount point of CIFS, build_path_from_dentry()
returns the pointer to kmalloc-ed memory with terminating zero (this is
empty FileName to be passed to SMB2 CREATE request). This pointer is assigned
to the `path` variable.
Then `path + 1` (to skip first backslash symbol) is passed to
cifs_convert_path_to_utf16(). This is incorrect for empty path and causes
out-of-bound memory access.

Get rid of this "increase by one". cifs_convert_path_to_utf16() already
contains the check for leading backslash in the path.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=212693
CC: <stable@vger.kernel.org> # v5.6+
Signed-off-by: NEugene Korenevsky <ekorenevsky@astralinux.ru>
Signed-off-by: NSteve French <stfrench@microsoft.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 9e4fe771
......@@ -2174,7 +2174,7 @@ smb3_notify(const unsigned int xid, struct file *pfile,
cifs_sb = CIFS_SB(inode->i_sb);
utf16_path = cifs_convert_path_to_utf16(path + 1, cifs_sb);
utf16_path = cifs_convert_path_to_utf16(path, cifs_sb);
if (utf16_path == NULL) {
rc = -ENOMEM;
goto notify_exit;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册