This is a note to let you know that I've just added the patch titled iwlwifi: handle DMA mapping failures to the 3.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: iwlwifi-handle-dma-mapping-failures.patch and it can be found in the queue-3.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From wujianguo@xxxxxxxxxx Fri Mar 7 16:59:06 2014 From: Johannes Berg <johannes.berg@xxxxxxxxx> Date: Thu, 27 Feb 2014 09:52:58 +0800 Subject: iwlwifi: handle DMA mapping failures To: <gregkh@xxxxxxxxxxxxxxxxxxx> Cc: <stable@xxxxxxxxxxxxxxx>, <lizefan@xxxxxxxxxx>, Johannes Berg <johannes.berg@xxxxxxxxx>, Jianguo Wu <wujianguo@xxxxxxxxxx> Message-ID: <1393465983-10548-5-git-send-email-wujianguo@xxxxxxxxxx> From: Johannes Berg <johannes.berg@xxxxxxxxx> commit 7c34158231b2eda8dcbd297be2bb1559e69cb433 upstream. The RX replenish code doesn't handle DMA mapping failures, which will cause issues if there actually is a failure. This was reported by Shuah Khan who found a DMA mapping framework warning ("device driver failed to check map error"). Reported-by: Shuah Khan <shuah.khan@xxxxxx> Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@xxxxxxxxx> Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx> [bwh: Backported to 3.2: - Adjust filename, context, indentation - Use bus(trans) instead of trans where necessary - Use hw_params(trans).rx_page_order instead of trans_pcie->rx_page_order] Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx> [wujg: Backported to 3.4: - Adjust context - Use trans instead of bus(trans) - Use hw_params(trans).rx_page_order instead of trans_pcie->rx_page_order] Signed-off-by: Jianguo Wu <wujianguo@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) --- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c @@ -315,6 +315,14 @@ static void iwlagn_rx_allocate(struct iw rxb->page_dma = dma_map_page(trans->dev, page, 0, PAGE_SIZE << hw_params(trans).rx_page_order, DMA_FROM_DEVICE); + if (dma_mapping_error(trans->dev, rxb->page_dma)) { + rxb->page = NULL; + spin_lock_irqsave(&rxq->lock, flags); + list_add(&rxb->list, &rxq->rx_used); + spin_unlock_irqrestore(&rxq->lock, flags); + __free_pages(page, hw_params(trans).rx_page_order); + return; + } /* dma address must be no more than 36 bits */ BUG_ON(rxb->page_dma & ~DMA_BIT_MASK(36)); /* and also 256 byte aligned! */ @@ -450,8 +458,19 @@ static void iwl_rx_handle_rxbuf(struct i dma_map_page(trans->dev, rxb->page, 0, PAGE_SIZE << hw_params(trans).rx_page_order, DMA_FROM_DEVICE); - list_add_tail(&rxb->list, &rxq->rx_free); - rxq->free_count++; + if (dma_mapping_error(trans->dev, rxb->page_dma)) { + /* + * free the page(s) as well to not break + * the invariant that the items on the used + * list have no page(s) + */ + __free_pages(rxb->page, hw_params(trans).rx_page_order); + rxb->page = NULL; + list_add_tail(&rxb->list, &rxq->rx_used); + } else { + list_add_tail(&rxb->list, &rxq->rx_free); + rxq->free_count++; + } } else list_add_tail(&rxb->list, &rxq->rx_used); spin_unlock_irqrestore(&rxq->lock, flags); Patches currently in stable-queue which might be from johannes.berg@xxxxxxxxx are queue-3.4/iwlwifi-dvm-don-t-send-bt_config-on-devices-w-o-bluetooth.patch queue-3.4/iwlwifi-handle-dma-mapping-failures.patch queue-3.4/iwlwifi-pcie-add-skus-for-6000-6005-and-6235-series.patch queue-3.4/iwlwifi-protect-sram-debugfs.patch queue-3.4/iwlwifi-fix-flow-handler-debug-code.patch queue-3.4/iwlwifi-don-t-handle-masked-interrupt.patch queue-3.4/iwlwifi-dvm-fix-calling-ieee80211_chswitch_done-with-null.patch queue-3.4/iwlwifi-always-copy-first-16-bytes-of-commands.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html