crypto: picoxcell: add missed tasklet_kill
PATCH 1/1 crypto: picoxcell: add missed tasklet_kill
This driver forgets to kill tasklet when probe fails and remove. Add the calls to fix it.
--- drivers/crypto/picoxcell_crypto.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/crypto/picoxcell_crypto.c +2 -0
@@ -1755,6 +1755,7 @@ static int spacc_probe(struct platform_device *pdev)if (!ret)return 0 ; +tasklet_kill (&engine->complete);del_timer_sync (&engine->packet_timeout);device_remove_file (&pdev->dev, &dev_attr_stat_irq_thresh); err_clk_disable:
@@ -1771,6 +1772,7 @@ static int spacc_remove(struct platform_device *pdev)struct spacc_alg *alg, *next;struct spacc_engine *engine =platform_get_drvdata (pdev); +tasklet_kill (&engine->complete);del_timer_sync (&engine->packet_timeout);device_remove_file (&pdev->dev, &dev_attr_stat_irq_thresh);
Signature · 1 line
2.24.0
Herbert Xu
maintainerQuoted 4 lines · Chuhong Yuan
This driver forgets to kill tasklet when probe fails and remove. Add the calls to fix it.
Signed-off-by Chuhong Yuan <[email protected]>
Yes this driver does look buggy but I think your patch isn't enough.
drivers/crypto/picoxcell_crypto.c static int spacc_probe(struct platform_device *pdev) · line 1758
Quoted 9 lines
drivers/crypto/picoxcell_crypto.c +1
-0@@ -1755,6 +1755,7 @@ static int spacc_probe(struct platform_device *pdev)if (!ret)return 0 ; +tasklet_kill (&engine->complete);
The tasklet is schedule by the IRQ handler so you should not kill it until the IRQ handler has been unregistered.
This driver is also buggy because it registers the IRQ handler before initialising the tasklet. You must always be prepared for spurious IRQs. IOW, as soon as you register the IRQ handler you must be prepared for it to be called.
drivers/crypto/picoxcell_crypto.c static int spacc_remove(struct platform_device *pdev) · line 1775
Quoted 5 lines
drivers/crypto/picoxcell_crypto.c +1
-0@@ -1771,6 +1772,7 @@ static int spacc_remove(struct platform_device *pdev)struct spacc_alg *alg, *next;struct spacc_engine *engine =platform_get_drvdata (pdev); +tasklet_kill (&engine->complete);
Ditto.
However, the IRQ handler is registered through devm which makes it hard to kill the tasklet after unregistering it. We should probably convert it to a normal request_irq so we can control how it's unregistered.
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
Quoted 31 lines · Herbert Xu
Quoted 4 lines · Chuhong Yuan
This driver forgets to kill tasklet when probe fails and remove. Add the calls to fix it.
Signed-off-by Chuhong Yuan <[email protected]>Yes this driver does look buggy but I think your patch isn't enough.
drivers/crypto/picoxcell_crypto.c static int spacc_probe(struct platform_device *pdev) · line 1758
Quoted 9 lines
drivers/crypto/picoxcell_crypto.c +1
-0@@ -1755,6 +1755,7 @@ static int spacc_probe(struct platform_device *pdev)if (!ret)return 0 ; +tasklet_kill (&engine->complete);The tasklet is schedule by the IRQ handler so you should not kill it until the IRQ handler has been unregistered.
This driver is also buggy because it registers the IRQ handler before initialising the tasklet. You must always be prepared for spurious IRQs. IOW, as soon as you register the IRQ handler you must be prepared for it to be called.
Quoted 4 lines
drivers/crypto/picoxcell_crypto.c +0
-0@@ -1771,6 +1772,7 @@ static int spacc_remove(struct platform_device *pdev)struct spacc_alg *alg, *next;struct spacc_engine *engine =platform_get_drvdata (pdev);
Quoted 8 lines
drivers/crypto/picoxcell_crypto.c static int spacc_remove(struct platform_device *pdev) · line 1775
Quoted 1 line
drivers/crypto/picoxcell_crypto.c +1
-0+tasklet_kill (&engine->complete);Ditto.
However, the IRQ handler is registered through devm which makes it hard to kill the tasklet after unregistering it. We should probably convert it to a normal
request_irqso we can control how it's unregistered.
Or inversely, registering the tasklet_kill() through devm, so that it is called *after* the ISR unregistration.
Regards.
Herbert Xu
maintainerQuoted 8 lines · Marc Gonzalez
Quoted 5 lines
However, the IRQ handler is registered through devm which makes it hard to kill the tasklet after unregistering it. We should probably convert it to a normal
request_irqso we can control how it's unregistered.Or inversely, registering the
tasklet_kill()through devm, so that it is called *after* the ISR unregistration.
Good Point. Chuhong, could you please try this approach to see if it gives us better code?
Thanks,
Signature · 8 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel