crypto: qat - fix IRQ cleanup on 6xxx probe failure
Subsystems (3)
Giovanni Cabiddu
maintainerPATCH 1/1 crypto: qat - fix IRQ cleanup on 6xxx probe failure
When adf_dev_up() partially completes and then fails, the IRQ handlers registered during adf_isr_resource_alloc() are not detached before the MSI-X vectors are released.
Since the device is enabled with pcim_enable_device(), calling pci_alloc_irq_vectors() internally registers pcim_msi_release() as a devres action. On probe failure, devres runs pcim_msi_release() which calls pci_free_irq_vectors(), tearing down the MSI-X vectors while IRQ handlers (for example 'qat0-bundle0') are still attached. This causes remove_proc_entry() warnings:
[ 22.163964] remove_proc_entry: removing non-empty directory 'irq/143', leaking at least 'qat0-bundle0'
Moving the devm_add_action_or_reset() before adf_dev_up() does not solve the problem since devres runs in LIFO order and pcim_msi_release(), registered later inside adf_dev_up(), would still fire before adf_device_down().
Fix by calling adf_dev_down() explicitly when adf_dev_up() fails, to properly free IRQ handlers before devres releases the MSI-X vectors.
--- drivers/crypto/intel/qat/qat_6xxx/adf_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/crypto/intel/qat/qat_6xxx/adf_drv.c +3 -1
@@ -209,8 +209,10 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)return ret; ret =adf_dev_up (accel_dev, true); -if (ret) +if (ret) { +adf_dev_down (accel_dev);return ret; + } ret =devm_add_action_or_reset (dev, adf_device_down, accel_dev);if (ret)
base-commit: 313ea1d8a965b395d2e1570bd7cc2f4fa25d0e49
Signature · 1 line
2.53.0
Herbert Xu
maintainerQuoted 21 lines · Giovanni Cabiddu
When
adf_dev_up()partially completes and then fails, the IRQ handlers registered duringadf_isr_resource_alloc()are not detached before the MSI-X vectors are released.Since the device is enabled with
pcim_enable_device(), callingpci_alloc_irq_vectors()internally registerspcim_msi_release()as a devres action. On probe failure, devres runspcim_msi_release()which callspci_free_irq_vectors(), tearing down the MSI-X vectors while IRQ handlers (for example 'qat0-bundle0') are still attached. This causesremove_proc_entry()warnings:[ 22.163964] remove_proc_entry: removing non-empty directory 'irq/143', leaking at least 'qat0-bundle0'Moving the
devm_add_action_or_reset()beforeadf_dev_up()does not solve the problem since devres runs in LIFO order andpcim_msi_release(), registered later insideadf_dev_up(), would still fire beforeadf_device_down().Fix by calling
adf_dev_down()explicitly whenadf_dev_up()fails, to properly free IRQ handlers before devres releases the MSI-X vectors.
Quoted 8 lines
Fixes 17fd7514ae68 ("crypto: qat - add qat_6xxx driver")Signed-off-by Giovanni Cabiddu <[email protected]>Reviewed-by Ahsan Atta <[email protected]>Reviewed-by Laurent M Coquerel <[email protected]>--- drivers/crypto/intel/qat/qat_6xxx/adf_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
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