From 9de04e141d3fb501c7240977e60fea19bb3c923c Mon Sep 17 00:00:00 2001 From: Oliver Neukum Date: May 09 2023 11:06:17 +0000 Subject: mwl8k: Fix a double Free in mwl8k_probe_hw (git-fixes). --- diff --git a/patches.suse/mwl8k-Fix-a-double-Free-in-mwl8k_probe_hw.patch b/patches.suse/mwl8k-Fix-a-double-Free-in-mwl8k_probe_hw.patch new file mode 100644 index 0000000..6f8055c --- /dev/null +++ b/patches.suse/mwl8k-Fix-a-double-Free-in-mwl8k_probe_hw.patch @@ -0,0 +1,37 @@ +From a8e083ee8e2a6c94c29733835adae8bf5b832748 Mon Sep 17 00:00:00 2001 +From: Lv Yunlong +Date: Fri, 2 Apr 2021 11:26:27 -0700 +Subject: [PATCH] mwl8k: Fix a double Free in mwl8k_probe_hw +Git-commit: a8e083ee8e2a6c94c29733835adae8bf5b832748 +References: git-fixes +Patch-mainline: v5.13-rc1 + +In mwl8k_probe_hw, hw->priv->txq is freed at the first time by +dma_free_coherent() in the call chain: +if(!priv->ap_fw)->mwl8k_init_txqs(hw)->mwl8k_txq_init(hw, i). + +Then in err_free_queues of mwl8k_probe_hw, hw->priv->txq is freed +at the second time by mwl8k_txq_deinit(hw, i)->dma_free_coherent(). + +My patch set txq->txd to NULL after the first free to avoid the +double free. + +Fixes: a66098daacee2 ("mwl8k: Marvell TOPDOG wireless driver") +Signed-off-by: Lv Yunlong +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20210402182627.4256-1-lyl2019@mail.ustc.edu.cn +Signed-off-by: Oliver Neukum +--- + drivers/net/wireless/marvell/mwl8k.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/wireless/marvell/mwl8k.c ++++ b/drivers/net/wireless/marvell/mwl8k.c +@@ -1469,6 +1469,7 @@ static int mwl8k_txq_init(struct ieee802 + txq->skb = kcalloc(MWL8K_TX_DESCS, sizeof(*txq->skb), GFP_KERNEL); + if (txq->skb == NULL) { + pci_free_consistent(priv->pdev, size, txq->txd, txq->txd_dma); ++ txq->txd = NULL; + return -ENOMEM; + } + diff --git a/series.conf b/series.conf index 8ead06b..6ab7d9e 100644 --- a/series.conf +++ b/series.conf @@ -60461,6 +60461,7 @@ patches.suse/ibmvnic-queue-reset-work-in-system_long_wq.patch patches.suse/rtlwifi-8821ae-upgrade-PHY-and-RF-parameters.patch patches.suse/ipw2x00-potential-buffer-overflow-in-libipw_wx_set_e.patch + patches.suse/mwl8k-Fix-a-double-Free-in-mwl8k_probe_hw.patch patches.suse/msft-hv-2332-net-mana-Add-a-driver-for-Microsoft-Azure-Network-Ad.patch patches.suse/mac80211-clear-the-beacon-s-CRC-after-channel-switch.patch patches.suse/mac80211-bail-out-if-cipher-schemes-are-invalid.patch