Files
kernel_arpi/include/linux
Logan Gunthorpe f99958a96c dmaengine: Store module owner in dma_device struct
[ Upstream commit dae7a589c1 ]

dma_chan_to_owner() dereferences the driver from the struct device to
obtain the owner and call module_[get|put](). However, if the backing
device is unbound before the dma_device is unregistered, the driver
will be cleared and this will cause a NULL pointer dereference.

Instead, store a pointer to the owner module in the dma_device struct
so the module reference can be properly put when the channel is put, even
if the backing device was destroyed first.

This change helps to support a safer unbind of DMA engines.
If the dma_device is unregistered in the driver's remove function,
there's no guarantee that there are no existing clients and a users
action may trigger the WARN_ONCE in dma_async_device_unregister()
which is unlikely to leave the system in a consistent state.
Instead, a better approach is to allow the backing driver to go away
and fail any subsequent requests to it.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Link: https://lore.kernel.org/r/20191216190120.21374-2-logang@deltatee.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-02-24 08:36:40 +01:00
..
2019-09-17 10:27:46 -07:00
2020-02-19 19:53:09 +01:00
2019-09-16 09:56:27 -07:00
2020-02-11 04:35:52 -08:00
2020-01-26 10:01:07 +01:00
2020-02-24 08:36:27 +01:00
2019-09-05 19:52:33 -06:00
2019-12-17 19:55:30 +01:00
2019-11-29 10:10:13 +01:00
2019-09-24 15:54:08 -07:00
2019-10-02 06:36:50 -07:00
2019-09-07 04:28:05 -03:00
2019-12-13 08:42:53 +01:00
2020-01-09 10:19:59 +01:00
2019-12-13 08:43:18 +01:00
2019-10-31 14:01:40 -07:00
2019-09-25 17:51:41 -07:00
2019-09-07 21:42:25 +02:00
2019-10-02 10:06:45 +02:00
2019-10-14 15:04:01 -07:00