crypto: ccp - ccp_dmaengine_unregister release dma channels
ccp_dmaengine_register adds dma_chan->device_node to dma_dev->channels list
but ccp_dmaengine_unregister didn't remove them.
That can cause crashes in various dmaengine methods that tries to use dma_dev->channels
Fixes: 58ea8abf49
("crypto: ccp - Register the CCP as a DMA...")
Signed-off-by: Dāvis Mosāns <davispuh@gmail.com>
Acked-by: John Allen <john.allen@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
280ee3c3aa
commit
54cce8ecb9
1 changed files with 16 additions and 0 deletions
|
@ -632,6 +632,20 @@ static int ccp_terminate_all(struct dma_chan *dma_chan)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ccp_dma_release(struct ccp_device *ccp)
|
||||||
|
{
|
||||||
|
struct ccp_dma_chan *chan;
|
||||||
|
struct dma_chan *dma_chan;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
for (i = 0; i < ccp->cmd_q_count; i++) {
|
||||||
|
chan = ccp->ccp_dma_chan + i;
|
||||||
|
dma_chan = &chan->dma_chan;
|
||||||
|
tasklet_kill(&chan->cleanup_tasklet);
|
||||||
|
list_del_rcu(&dma_chan->device_node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int ccp_dmaengine_register(struct ccp_device *ccp)
|
int ccp_dmaengine_register(struct ccp_device *ccp)
|
||||||
{
|
{
|
||||||
struct ccp_dma_chan *chan;
|
struct ccp_dma_chan *chan;
|
||||||
|
@ -736,6 +750,7 @@ int ccp_dmaengine_register(struct ccp_device *ccp)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_reg:
|
err_reg:
|
||||||
|
ccp_dma_release(ccp);
|
||||||
kmem_cache_destroy(ccp->dma_desc_cache);
|
kmem_cache_destroy(ccp->dma_desc_cache);
|
||||||
|
|
||||||
err_cache:
|
err_cache:
|
||||||
|
@ -752,6 +767,7 @@ void ccp_dmaengine_unregister(struct ccp_device *ccp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dma_async_device_unregister(dma_dev);
|
dma_async_device_unregister(dma_dev);
|
||||||
|
ccp_dma_release(ccp);
|
||||||
|
|
||||||
kmem_cache_destroy(ccp->dma_desc_cache);
|
kmem_cache_destroy(ccp->dma_desc_cache);
|
||||||
kmem_cache_destroy(ccp->dma_cmd_cache);
|
kmem_cache_destroy(ccp->dma_cmd_cache);
|
||||||
|
|
Loading…
Add table
Reference in a new issue