Skip to content

Commit bb0579a

Browse files
Yunlongsgregkh
authored andcommitted
wireless: iwlwifi: Fix a double free in iwl_txq_dyn_alloc_dma
[ Upstream commit f973795 ] In iwl_txq_dyn_alloc_dma, txq->tfds is freed at first time by: iwl_txq_alloc()->goto err_free_tfds->dma_free_coherent(). But it forgot to set txq->tfds to NULL. Then the txq->tfds is freed again in iwl_txq_dyn_alloc_dma by: goto error->iwl_txq_gen2_free_memory()->dma_free_coherent(). My patch sets txq->tfds to NULL after the first free to avoid the double free. Fixes: 0cd1ad2 ("iwlwifi: move all bus-independent TX functions to common code") Signed-off-by: Lv Yunlong <lyl2019@mail.ustc.edu.cn> Link: https://lore.kernel.org/r/20210403054755.4781-1-lyl2019@mail.ustc.edu.cn Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent b4b911b commit bb0579a

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

  • drivers/net/wireless/intel/iwlwifi/queue

‎drivers/net/wireless/intel/iwlwifi/queue/tx.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,6 +1148,7 @@ int iwl_txq_alloc(struct iwl_trans *trans, struct iwl_txq *txq, int slots_num,
11481148
return 0;
11491149
err_free_tfds:
11501150
dma_free_coherent(trans->dev, tfd_sz, txq->tfds, txq->dma_addr);
1151+
txq->tfds = NULL;
11511152
error:
11521153
if (txq->entries && cmd_queue)
11531154
for (i = 0; i < slots_num; i++)

0 commit comments

Comments
 (0)