Re: [PATCH v4] wifi: brcmfmac: Fix use-after-free bug in brcmf_cfg80211_detach

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/6/2023 8:30 AM, Zheng Wang wrote:
This is the candidate patch of CVE-2023-47233 :
https://nvd.nist.gov/vuln/detail/CVE-2023-47233

[...]

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

Fixes: e756af5b30b0 ("brcmfmac: add e-scan support.")
Reviewed-by: Arend van Spriel <arend.vanspriel@xxxxxxxxxxxx>
Signed-off-by: Zheng Wang <zyytlz.wz@xxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
---
v4:
- rename the subject and add CVE number as Ping-Ke Shih suggested
v3:
- rename the subject as Johannes suggested
v2:
- fix the error of kernel test bot reported
---
  drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 667462369a32..646ec8bdf512 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -8431,6 +8431,9 @@ void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg)
  	if (!cfg)
  		return;
+ if (timer_pending(&cfg->escan_timeout))
+		del_timer_sync(&cfg->escan_timeout);

del_timer_sync() is kept for legacy. Use timer_delete_sync() instead [1]. Also checking timer_pending() before deletion is useless looking at the return values from timer_delete_sync():

 * Return:
 * * %0	- The timer was not pending
 * * %1	- The timer was pending and deactivated

[1] https://elixir.bootlin.com/linux/latest/source/include/linux/timer.h#L190
+	cancel_work_sync(&cfg->escan_timeout_work);
  	brcmf_pno_detach(cfg);
  	brcmf_btcoex_detach(cfg);
  	wiphy_unregister(cfg->wiphy);

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux