Skip to contentSkip to conversation

crypto: ccp: kill v3 IRQ tasklet during teardown

PATCH In review Jiale Yao 2 participants 2 messages Sep 20 – Sep 23

Subsystems (2)
lore
Share & tools
lore

Jiale Yao

author
#0 lore raw

PATCH 1/1 crypto: ccp: kill v3 IRQ tasklet during teardown

On PCI devices using MSI-X, ccp_irq_handler() schedules irq_tasklet. The teardown paths release the IRQ but do not drain a tasklet that was already queued, so it can access ccp after the device-managed allocation has been released.

Kill the tasklet after releasing the IRQ in both the initialization error path and ccp_destroy().

Fixes 7b537b24e76a ("crypto: ccp - Change ISR handler method for a v3 CCP")
---
 drivers/crypto/ccp/ccp-dev-v3.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/crypto/ccp/ccp-dev-v3.c +4 -0
index fe69053b2394..e85b4ded417a 100644
@@ -506,6 +506,8 @@ static int ccp_init(struct ccp_device *ccp)
 			kthread_stop(ccp->cmd_q[i].kthread);
 
 	sp_free_ccp_irq(ccp->sp, ccp);
+	if (ccp->use_tasklet)
+		tasklet_kill(&ccp->irq_tasklet);
 
 e_pool:
 	for (i = 0; i < ccp->cmd_q_count; i++)
@@ -545,6 +547,8 @@ static void ccp_destroy(struct ccp_device *ccp)
 			kthread_stop(ccp->cmd_q[i].kthread);
 
 	sp_free_ccp_irq(ccp->sp, ccp);
+	if (ccp->use_tasklet)
+		tasklet_kill(&ccp->irq_tasklet);
 
 	for (i = 0; i < ccp->cmd_q_count; i++)
 		dma_pool_destroy(ccp->cmd_q[i].dma_pool);
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 8 lines · Jiale Yao

On PCI devices using MSI-X, ccp_irq_handler() schedules irq_tasklet. The teardown paths release the IRQ but do not drain a tasklet that was already queued, so it can access ccp after the device-managed allocation has been released.

Kill the tasklet after releasing the IRQ in both the initialization error path and ccp_destroy().

Quoted 6 lines
Fixes 7b537b24e76a ("crypto: ccp - Change ISR handler method for a v3 CCP")
---
 drivers/crypto/ccp/ccp-dev-v3.c | 4 ++++
 1 file changed, 4 insertions(+)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt