Commit 7dc4a6b5 authored by Brian Norris's avatar Brian Norris Committed by Kalle Valo

mwifiex: pcie: don't allow cmd buffer reuse after reset

In rogue cases (due to other bugs) it's possible we try to process an
old command response *after* resetting the device. This could trigger a
double-free (or the SKB can get reallocated elsewhere...causing other
memory corruptions) in mwifiex_pcie_process_cmd_complete().

For safety (and symmetry) let's always NULL out the command buffer as we
free it up. We're already doing this for the command response buffer.
Signed-off-by: default avatarBrian Norris <briannorris@chromium.org>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 4b1f5a0d
...@@ -1043,12 +1043,14 @@ static int mwifiex_pcie_delete_cmdrsp_buf(struct mwifiex_adapter *adapter) ...@@ -1043,12 +1043,14 @@ static int mwifiex_pcie_delete_cmdrsp_buf(struct mwifiex_adapter *adapter)
mwifiex_unmap_pci_memory(adapter, card->cmdrsp_buf, mwifiex_unmap_pci_memory(adapter, card->cmdrsp_buf,
PCI_DMA_FROMDEVICE); PCI_DMA_FROMDEVICE);
dev_kfree_skb_any(card->cmdrsp_buf); dev_kfree_skb_any(card->cmdrsp_buf);
card->cmdrsp_buf = NULL;
} }
if (card && card->cmd_buf) { if (card && card->cmd_buf) {
mwifiex_unmap_pci_memory(adapter, card->cmd_buf, mwifiex_unmap_pci_memory(adapter, card->cmd_buf,
PCI_DMA_TODEVICE); PCI_DMA_TODEVICE);
dev_kfree_skb_any(card->cmd_buf); dev_kfree_skb_any(card->cmd_buf);
card->cmd_buf = NULL;
} }
return 0; return 0;
} }
...@@ -2934,7 +2936,6 @@ static void mwifiex_pcie_free_buffers(struct mwifiex_adapter *adapter) ...@@ -2934,7 +2936,6 @@ static void mwifiex_pcie_free_buffers(struct mwifiex_adapter *adapter)
mwifiex_pcie_delete_evtbd_ring(adapter); mwifiex_pcie_delete_evtbd_ring(adapter);
mwifiex_pcie_delete_rxbd_ring(adapter); mwifiex_pcie_delete_rxbd_ring(adapter);
mwifiex_pcie_delete_txbd_ring(adapter); mwifiex_pcie_delete_txbd_ring(adapter);
card->cmdrsp_buf = NULL;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment