Skip to content

Commit

Permalink
iwlwifi: pcie: avoid dma unmap/remap in crash dump
Browse files Browse the repository at this point in the history
DMA-API debug code pointed out that in this code path we
never check the return value of dma_map_page(), which could
fail.

However, we don't really even want to unmap/remap, we just
want to ensure that we can actually access the last version
of the data that the (now-dead) device may have written, so
only need to dma_sync_single_for_cpu() instead.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210819183728.5987f35883a2.I2d9ea5ecc69a5e5947b546fb15f33363a0595651@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
  • Loading branch information
Johannes Berg authored and Luca Coelho committed Aug 26, 2021
1 parent 40063f6 commit 59a6ee9
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions drivers/net/wireless/intel/iwlwifi/pcie/trans.c
Original file line number Diff line number Diff line change
Expand Up @@ -2968,8 +2968,8 @@ static u32 iwl_trans_pcie_dump_rbs(struct iwl_trans *trans,
struct iwl_rx_mem_buffer *rxb = rxq->queue[i];
struct iwl_fw_error_dump_rb *rb;

dma_unmap_page(trans->dev, rxb->page_dma, max_len,
DMA_FROM_DEVICE);
dma_sync_single_for_cpu(trans->dev, rxb->page_dma,
max_len, DMA_FROM_DEVICE);

rb_len += sizeof(**data) + sizeof(*rb) + max_len;

Expand All @@ -2978,10 +2978,6 @@ static u32 iwl_trans_pcie_dump_rbs(struct iwl_trans *trans,
rb = (void *)(*data)->data;
rb->index = cpu_to_le32(i);
memcpy(rb->data, page_address(rxb->page), max_len);
/* remap the page for the free benefit */
rxb->page_dma = dma_map_page(trans->dev, rxb->page,
rxb->offset, max_len,
DMA_FROM_DEVICE);

*data = iwl_fw_error_next_data(*data);
}
Expand Down

0 comments on commit 59a6ee9

Please sign in to comment.