kernel_samsung_a53x/drivers/net/wireless/broadcom/brcm80211/brcmfmac
Zheng Wang c82abfa57d wifi: brcmfmac: Fix use-after-free bug in brcmf_cfg80211_detach
[ Upstream commit 0f7352557a35ab7888bc7831411ec8a3cbe20d78 ]

This is the candidate patch of CVE-2023-47233 :
https://nvd.nist.gov/vuln/detail/CVE-2023-47233

In brcm80211 driver,it starts with the following invoking chain
to start init a timeout worker:

->brcmf_usb_probe
  ->brcmf_usb_probe_cb
    ->brcmf_attach
      ->brcmf_bus_started
        ->brcmf_cfg80211_attach
          ->wl_init_priv
            ->brcmf_init_escan
              ->INIT_WORK(&cfg->escan_timeout_work,
		  brcmf_cfg80211_escan_timeout_worker);

If we disconnect the USB by hotplug, it will call
brcmf_usb_disconnect to make cleanup. The invoking chain is :

brcmf_usb_disconnect
  ->brcmf_usb_disconnect_cb
    ->brcmf_detach
      ->brcmf_cfg80211_detach
        ->kfree(cfg);

While the timeout woker may still be running. This will cause
a use-after-free bug on cfg in brcmf_cfg80211_escan_timeout_worker.

Fix it by deleting the timer and canceling the worker in
brcmf_cfg80211_detach.

Fixes: e756af5b30b0 ("brcmfmac: add e-scan support.")
Signed-off-by: Zheng Wang <zyytlz.wz@163.com>
Cc: stable@vger.kernel.org
[arend.vanspriel@broadcom.com: keep timer delete as is and cancel work just before free]
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240107072504.392713-1-arend.vanspriel@broadcom.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 09:22:14 +01:00
..
bcdc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
bcdc.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
bcmsdh.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
btcoex.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
btcoex.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
bus.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cfg80211.c wifi: brcmfmac: Fix use-after-free bug in brcmf_cfg80211_detach 2024-11-19 09:22:14 +01:00
cfg80211.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
chip.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
chip.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
common.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
common.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
commonring.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
commonring.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
core.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
core.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
debug.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
debug.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dmi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
feature.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
feature.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
firmware.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
firmware.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
flowring.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
flowring.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fweh.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fweh.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fwil.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fwil.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fwil_types.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fwsignal.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fwsignal.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
msgbuf.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
msgbuf.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
of.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
of.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
p2p.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
p2p.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pcie.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pcie.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pno.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pno.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
proto.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
proto.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sdio.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sdio.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tracepoint.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tracepoint.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
usb.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
usb.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vendor.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vendor.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00