Subject: CVE-2024-46736: smb: client: fix double put of @cfile in smb2_rename_path()

From: Greg Kroah-Hartman <[email-masked]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

smb: client: fix double put of @cfile in smb2_rename_path()

If smb2_set_path_attr() is called with a valid @cfile and returned
-EINVAL, we need to call cifs_get_writable_path() again as the
reference of @cfile was already dropped by previous smb2_compound_op()
call.

The Linux kernel CVE team has assigned CVE-2024-46736 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 6.6.32 with commit 1e60bc0e9543 and fixed in 6.6.51 with commit b27ea9c96efd
	Issue introduced in 6.9 with commit 71f15c90e785 and fixed in 6.10.10 with commit 1a46c7f6546b
	Issue introduced in 6.9 with commit 71f15c90e785 and fixed in 6.11 with commit 3523a3df03c6

Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2024-46736
will be updated if fixes are backported, please check that for the most
up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
	fs/smb/client/smb2inode.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/b27ea9c96efd2c252a981fb00d0f001b86c90f3e
	https://git.kernel.org/stable/c/1a46c7f6546b73cbf36f5a618a1a6bbb45391eb3
	https://git.kernel.org/stable/c/3523a3df03c6f04f7ea9c2e7050102657e331a4f