Subject: CVE-2023-52846: hsr: Prevent use after free in prp_create_tagged_frame()

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

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

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

hsr: Prevent use after free in prp_create_tagged_frame()

The prp_fill_rct() function can fail.  In that situation, it frees the
skb and returns NULL.  Meanwhile on the success path, it returns the
original skb.  So it's straight forward to fix bug by using the returned
value.

The Linux kernel CVE team has assigned CVE-2023-52846 to this issue.

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

	Issue introduced in 5.9 with commit 451d8123f897 and fixed in 5.10.201 with commit ddf4e04e946a
	Issue introduced in 5.9 with commit 451d8123f897 and fixed in 5.15.139 with commit a1a485e45d24
	Issue introduced in 5.9 with commit 451d8123f897 and fixed in 6.1.63 with commit 6086258bd5ea
	Issue introduced in 5.9 with commit 451d8123f897 and fixed in 6.5.12 with commit 1787b9f0729d
	Issue introduced in 5.9 with commit 451d8123f897 and fixed in 6.6.2 with commit d103fb672690
	Issue introduced in 5.9 with commit 451d8123f897 and fixed in 6.7 with commit 876f8ab52363

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-2023-52846
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:
	net/hsr/hsr_forward.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/ddf4e04e946aaa6c458b8b6829617cc44af2bffd
	https://git.kernel.org/stable/c/a1a485e45d24b1cd8fe834fd6f1b06e2903827da
	https://git.kernel.org/stable/c/6086258bd5ea7b5c706ff62da42b8e271b2401db
	https://git.kernel.org/stable/c/1787b9f0729d318d67cf7c5a95f0c3dba9a7cc18
	https://git.kernel.org/stable/c/d103fb6726904e353b4773188ee3d3acb4078363
	https://git.kernel.org/stable/c/876f8ab52363f649bcc74072157dfd7adfbabc0d