Subject: CVE-2024-35869: smb: client: guarantee refcounted children from parent session

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

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

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

smb: client: guarantee refcounted children from parent session

Avoid potential use-after-free bugs when walking DFS referrals,
mounting and performing DFS failover by ensuring that all children
from parent @tcon->ses are also refcounted.  They're all needed across
the entire DFS mount.  Get rid of @tcon->dfs_ses_list while we're at
it, too.

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

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

	Fixed in 6.6.29 with commit 645f332c6b63
	Fixed in 6.8.5 with commit e1db9ae87b71
	Fixed in 6.9 with commit 062a7f0ff46e

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-35869
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/cifsglob.h
	fs/smb/client/cifsproto.h
	fs/smb/client/connect.c
	fs/smb/client/dfs.c
	fs/smb/client/dfs.h
	fs/smb/client/dfs_cache.c
	fs/smb/client/misc.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/645f332c6b63499cc76197f9b6bffcc659ba64cc
	https://git.kernel.org/stable/c/e1db9ae87b7148c021daee1fcc4bc71b2ac58a79
	https://git.kernel.org/stable/c/062a7f0ff46eb57aff526897bd2bebfdb1d3046a