From bippy-c9c4e1df01b2 Mon Sep 17 00:00:00 2001
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: <linux-cve-announce@vger.kernel.org>
Reply-to: <cve@kernel.org>, <linux-kernel@vger.kernel.org>
Subject: CVE-2023-52530: wifi: mac80211: fix potential key use-after-free

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

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

wifi: mac80211: fix potential key use-after-free

When ieee80211_key_link() is called by ieee80211_gtk_rekey_add()
but returns 0 due to KRACK protection (identical key reinstall),
ieee80211_gtk_rekey_add() will still return a pointer into the
key, in a potential use-after-free. This normally doesn't happen
since it's only called by iwlwifi in case of WoWLAN rekey offload
which has its own KRACK protection, but still better to fix, do
that by returning an error code and converting that to success on
the cfg80211 boundary only, leaving the error for bad callers of
ieee80211_gtk_rekey_add().

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


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

	Issue introduced in 4.14 with commit fdf7cb4185b6 and fixed in 5.10.228 with commit e8e599a63506
	Issue introduced in 4.14 with commit fdf7cb4185b6 and fixed in 5.15.169 with commit e8a834eb09bb
	Issue introduced in 4.14 with commit fdf7cb4185b6 and fixed in 6.1.57 with commit 2f4e16e39e4f
	Issue introduced in 4.14 with commit fdf7cb4185b6 and fixed in 6.5.7 with commit 65c72a720170
	Issue introduced in 4.14 with commit fdf7cb4185b6 and fixed in 6.6 with commit 31db78a4923e
	Issue introduced in 3.2.95 with commit ef810e7c3d2a
	Issue introduced in 3.16.50 with commit a0a8a11d1630
	Issue introduced in 3.18.82 with commit 6891c6fd2a50
	Issue introduced in 4.1.47 with commit 003aa22c9619
	Issue introduced in 4.4.99 with commit 6440f0ee8a17
	Issue introduced in 4.9.63 with commit 2586fa0007dc
	Issue introduced in 4.13.14 with commit a9ab1b2e30e8

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-52530
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/mac80211/cfg.c
	net/mac80211/key.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/e8e599a635066c50ac214c3e10858f1d37e03022
	https://git.kernel.org/stable/c/e8a834eb09bb95c2bf9c76f1a28ecef7d8c439d0
	https://git.kernel.org/stable/c/2f4e16e39e4f5e78248dd9e51276a83203950b36
	https://git.kernel.org/stable/c/65c72a7201704574dace708cbc96a8f367b1491d
	https://git.kernel.org/stable/c/31db78a4923ef5e2008f2eed321811ca79e7f71b
