linux/drivers/net/wireless/iwlwifi
Emmanuel Grumbach 39644e9ac5 iwlagn: unmap cmd queue's tfds as BIDI
If the driver is unloaded while there is still a host command in
flight, its tfd will be freed by iwl_tx_queue_free.
This function is called for both types of queues: Tx queues and cmd
queue. This didn't take in count the fact that in Tx queues, tfds are
mapped as TO_DEVICE (besides the first TB), whereas in cmd queue, all
TBs are mapped as BIDI.

Hence, tx_queue_free unmapped the second (and higher) TB of each tfd
in the cmd queue as TO_DEVICE, whereas they must be freed as BIDI.
This means that if a multi TFD is in flight while we unload the
driver (which is quite unlikely but can happen), we will get the
warning below.

This patch fixes this.

[  445.234060] ------------[ cut here ]------------
[  445.236273] WARNING: at lib/dma-debug.c:861 check_unmap+0x337/0x780()
[  445.236654] iwlagn 0000:02:00.0: DMA-API: device driver frees DMA memory with different direction [device address=0x0000000126950540] [size=8 bytes] [mapped with DMA_BIDIRECTIONAL] [unmapped with DMA_TO_DEVICE]
[  445.236654] Modules linked in: ...
[  445.236654] Pid: 1415, comm: modprobe Not tainted 3.1.0-rc4-wl-65912-g5215ff1-dirty #79
[  445.236654] Call Trace:
[  445.236654]  [<ffffffff81043a51>] warn_slowpath_common+0x71/0xa0
[  445.236654]  [<ffffffff81043b37>] warn_slowpath_fmt+0x47/0x50
[  445.236654]  [<ffffffff8121e687>] check_unmap+0x337/0x780
[  445.236654]  [<ffffffff810e9136>] ? free_one_page+0x156/0x320
[  445.236654]  [<ffffffff8121ec5a>] debug_dma_unmap_page+0x5a/0x60
[  445.236654]  [<ffffffffa021d701>] iwlagn_unmap_tfd.isra.11+0x121/0x1c0 [iwlagn]
[  445.236654]  [<ffffffffa021ddf2>] iwlagn_txq_free_tfd+0x42/0x70 [iwlagn]
[  445.236654]  [<ffffffffa02121de>] iwl_tx_queue_unmap+0x4e/0x70 [iwlagn]
[  445.236654]  [<ffffffffa0212fad>] iwl_trans_pcie_tx_free+0x10d/0x440 [iwlagn]
[  445.236654]  [<ffffffff81064959>] ? destroy_workqueue+0xb9/0x1e0
[  445.236654]  [<ffffffffa021330a>] iwl_trans_pcie_free+0x2a/0x2c0 [iwlagn]
[  445.236654]  [<ffffffffa022f4f2>] iwl_remove+0x149/0x17e [iwlagn]
[  445.236654]  [<ffffffffa022f546>] iwl_pci_remove+0x1f/0x65 [iwlagn]
[  445.236654]  [<ffffffff81228337>] pci_device_remove+0x47/0x120
[  445.236654]  [<ffffffff8134566c>] __device_release_driver+0x7c/0xe0
[  445.236654]  [<ffffffff81345dc8>] driver_detach+0xc8/0xd0
[  445.236654]  [<ffffffff813454c8>] bus_remove_driver+0x88/0xe0
[  445.236654]  [<ffffffff81346572>] driver_unregister+0x62/0xa0
[  445.236654]  [<ffffffff812271d4>] pci_unregister_driver+0x44/0xc0
[  445.236654]  [<ffffffffa0211ce5>] iwl_pci_unregister_driver+0x15/0x20 [iwlagn]
[  445.236654]  [<ffffffffa022f595>] iwl_exit+0x9/0xa74 [iwlagn]
[  445.236654]  [<ffffffff810918f4>] sys_delete_module+0x184/0x240
[  445.236654]  [<ffffffff81452ece>] ? retint_swapgs+0xe/0x13
[  445.236654]  [<ffffffff8121098e>] ? trace_hardirqs_on_thunk+0x3a/0x3f
[  445.236654]  [<ffffffff81459e2b>] system_call_fastpath+0x16/0x1b
[  445.236654] ---[ end trace 1fbc362b7dbe5d74 ]---
[  445.236654] Mapped at:
[  445.236654]  [<ffffffff8121d7cb>] debug_dma_map_page+0x8b/0x150
[  445.236654]  [<ffffffffa021e7b7>] iwl_enqueue_hcmd+0x837/0xa40 [iwlagn]
[  445.236654]  [<ffffffffa021f92d>] iwl_trans_pcie_send_cmd+0x8d/0x580 [iwlagn]
[  445.236654]  [<ffffffffa01f7c75>] iwl_send_calib_results+0x75/0xd0 [iwlagn]
[  445.236654]  [<ffffffffa01f21f6>] iwlagn_alive_notify+0x196/0x1f0 [iwlagn]
[  445.386500] iwlagn 0000:02:00.0: PCI INT A disabled

Reported-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-09-19 15:58:26 -04:00
..
iwl-1000.c iwlagn: iwl-pci doesn't include iwl-dev any more 2011-08-29 15:30:30 -04:00
iwl-2000.c iwlagn: enable 11n support for "_d" sku 2011-09-14 13:56:41 -04:00
iwl-5000-hw.h
iwl-5000.c iwlagn: iwl-pci doesn't include iwl-dev any more 2011-08-29 15:30:30 -04:00
iwl-6000-hw.h
iwl-6000.c iwlagn: iwl-pci doesn't include iwl-dev any more 2011-08-29 15:30:30 -04:00
iwl-agn-calib.c iwlagn: bus layer chooses its transport layer 2011-08-29 15:25:32 -04:00
iwl-agn-calib.h iwlagn: remove iwlagn_hcmd_utils structure and call directly 2011-07-11 15:02:10 -04:00
iwl-agn-eeprom.c iwlagn: Rename iwlcore prefix 2011-08-29 15:25:29 -04:00
iwl-agn-hw.h iwlagn: iwl-dev.h doesn't include iwl-fh.h any more 2011-08-29 15:30:28 -04:00
iwl-agn-lib.c iwlagn: iwl-trans.c can't dereference iwl_priv any more 2011-09-14 13:56:39 -04:00
iwl-agn-rs.c iwlwifi: iwl-agn-rs.c: remove old comment 2011-08-30 15:38:53 -04:00
iwl-agn-rs.h
iwl-agn-rxon.c iwlagn: iwl-trans.c can't dereference iwl_priv any more 2011-09-14 13:56:39 -04:00
iwl-agn-sta.c iwlagn: move all iwl_is_XXX helpers to iwl-shared.h 2011-08-29 15:25:35 -04:00
iwl-agn-tt.c iwlagn: move the stop / wake queue logic to transport layer 2011-08-29 15:33:01 -04:00
iwl-agn-tt.h iwlagn: clean up of transport layer 2011-09-14 13:56:37 -04:00
iwl-agn-tx.c iwlagn: fix compilation when debug flags is unset 2011-09-14 13:56:42 -04:00
iwl-agn-ucode.c iwlagn: iwl-trans.c can't dereference iwl_priv any more 2011-09-14 13:56:39 -04:00
iwl-agn.c iwlagn: iwl-trans.c can't dereference iwl_priv any more 2011-09-14 13:56:39 -04:00
iwl-agn.h iwlagn: clean up of transport layer 2011-09-14 13:56:37 -04:00
iwl-bus.h iwlagn: all function iwl-io.c receive iwl_bus 2011-08-29 15:30:29 -04:00
iwl-commands.h iwlagn: only perform necessary calibration at init time 2011-09-14 13:56:34 -04:00
iwl-core.c iwlagn: iwl-trans.c can't dereference iwl_priv any more 2011-09-14 13:56:39 -04:00
iwl-core.h iwlagn: clean up of transport layer 2011-09-14 13:56:37 -04:00
iwl-csr.h iwlagn: iwl-trans.c can't dereference iwl_priv any more 2011-09-14 13:56:39 -04:00
iwl-debug.h iwlagn: add missing includes 2011-08-29 15:30:28 -04:00
iwl-debugfs.c iwlagn: move traffic_log back to upper layer 2011-09-14 13:56:38 -04:00
iwl-dev.h iwlagn: iwl-trans.c can't dereference iwl_priv any more 2011-09-14 13:56:39 -04:00
iwl-devtrace.c
iwl-devtrace.h iwlagn: all function iwl-io.c receive iwl_bus 2011-08-29 15:30:29 -04:00
iwl-eeprom.c iwlagn: all function iwl-io.c receive iwl_bus 2011-08-29 15:30:29 -04:00
iwl-eeprom.h iwlagn: Rename iwlcore prefix 2011-08-29 15:25:29 -04:00
iwl-fh.h iwlagn: add missing includes 2011-08-29 15:30:28 -04:00
iwl-helpers.h iwlagn: clean up of transport layer 2011-09-14 13:56:37 -04:00
iwl-io.c iwlagn: all function iwl-io.c receive iwl_bus 2011-08-29 15:30:29 -04:00
iwl-io.h iwlagn: all function iwl-io.c receive iwl_bus 2011-08-29 15:30:29 -04:00
iwl-led.c iwlagn: all function iwl-io.c receive iwl_bus 2011-08-29 15:30:29 -04:00
iwl-led.h
iwl-pci.c iwlagn: merge iwl_pci_down and iwl_pci_remove 2011-09-14 13:56:35 -04:00
iwl-pci.h iwlagn: adding special "D" SKU for 2000 series 2011-08-29 15:30:30 -04:00
iwl-power.c iwlagn: remove dereferences of priv from transport 2011-08-29 15:30:31 -04:00
iwl-power.h
iwl-prph.h iwlagn: cmd_queue moves to iwl_shared 2011-08-29 15:25:31 -04:00
iwl-rx.c iwlagn: clean up of transport layer 2011-09-14 13:56:37 -04:00
iwl-scan.c iwlagn: move iwl_free_pages to iwl-shared.h 2011-08-29 15:25:35 -04:00
iwl-shared.h iwlagn: fix compilation when debug flags is unset 2011-09-14 13:56:42 -04:00
iwl-sta.c iwlagn: remove priv dereferences from the transport layer 2011-09-14 13:56:36 -04:00
iwl-sta.h iwlagn: priv->sta_lock moves to iwl_shared 2011-08-29 15:25:32 -04:00
iwl-sv-open.c iwlagn: clean up of transport layer 2011-09-14 13:56:37 -04:00
iwl-testmode.h iwlagn: allow application own the uCode operation 2011-07-11 15:02:08 -04:00
iwl-trans-int-pcie.h iwlagn: unmap cmd queue's tfds as BIDI 2011-09-19 15:58:26 -04:00
iwl-trans-rx-pcie.c iwlagn: warn about buggy fw that doesn't set SEQ_RX_FRAME 2011-09-19 15:58:26 -04:00
iwl-trans-tx-pcie.c iwlagn: unmap cmd queue's tfds as BIDI 2011-09-19 15:58:26 -04:00
iwl-trans.c iwlagn: unmap cmd queue's tfds as BIDI 2011-09-19 15:58:26 -04:00
iwl-trans.h iwlagn: clean up of transport layer 2011-09-14 13:56:37 -04:00
Kconfig iwlagn: support new P2P implementation 2011-08-08 16:04:04 -04:00
Makefile iwlagn: move all the ICT related functions to iwl-trans-rx-pcie.c 2011-07-16 07:39:34 -07:00