linux/drivers/dma/idxd
Reinette Chatre 6744a030d8 dmaengine: idxd: Do not call DMX TX callbacks during workqueue disable
On driver unload any pending descriptors are flushed and pending
DMA descriptors are explicitly completed:
idxd_dmaengine_drv_remove() ->
	drv_disable_wq() ->
		idxd_wq_free_irq() ->
			idxd_flush_pending_descs() ->
				idxd_dma_complete_txd()

With this done during driver unload any remaining descriptor is
likely stuck and can be dropped. Even so, the descriptor may still
have a callback set that could no longer be accessible. An
example of such a problem is when the dmatest fails and the dmatest
module is unloaded. The failure of dmatest leaves descriptors with
dma_async_tx_descriptor::callback pointing to code that no longer
exist. This causes a page fault as below at the time the IDXD driver
is unloaded when it attempts to run the callback:
 BUG: unable to handle page fault for address: ffffffffc0665190
 #PF: supervisor instruction fetch in kernel mode
 #PF: error_code(0x0010) - not-present page

Fix this by clearing the callback pointers on the transmit
descriptors only when workqueue is disabled.

Fixes: 403a2e2365 ("dmaengine: idxd: change MSIX allocation based on per wq activation")
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Fenghua Yu <fenghua.yu@intel.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/37d06b772aa7f8863ca50f90930ea2fd80b38fc3.1670452419.git.reinette.chatre@intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2022-12-28 16:24:50 +05:30
..
bus.c Bus: Make remove callback return void tag 2021-07-27 19:12:14 +05:30
cdev.c Merge tag 'v6.1-rc7' into iommufd.git for-next 2022-12-02 12:04:39 -04:00
compat.c dmaengine: idxd: Fix a possible NULL pointer dereference 2021-08-02 12:35:10 +05:30
device.c dmaengine: idxd: Do not call DMX TX callbacks during workqueue disable 2022-12-28 16:24:50 +05:30
dma.c dmaengine: idxd: add missing callback function to support DMA_INTERRUPT 2022-05-16 23:18:21 +05:30
idxd.h dmaengine: idxd: Fix max batch size for Intel IAA 2022-11-08 10:43:55 +05:30
init.c Merge tag 'v6.1-rc7' into iommufd.git for-next 2022-12-02 12:04:39 -04:00
irq.c dmaengine: idxd: Remove unused struct idxd_fault 2022-09-29 13:11:33 +05:30
Makefile dmaengine: idxd: move dsa_drv support to compatible mode 2021-07-21 10:09:16 +05:30
perfmon.c dmaengine: idxd: Add IDXD performance monitor support 2021-04-25 21:46:12 +05:30
perfmon.h dmaengine: idxd: Add IDXD performance monitor support 2021-04-25 21:46:12 +05:30
registers.h dmaengine: idxd: add configuration for concurrent batch descriptor processing 2022-09-29 22:46:08 +05:30
submit.c dmaengine: idxd: fix retry value to be constant for duration of function call 2022-04-20 17:24:42 +05:30
sysfs.c Merge branch 'fixes' into next 2022-11-11 12:14:26 +05:30