crypto: marvell/octeontx - clean up VF resources when DOWN fails
Subsystems (3)
PATCH 1/1 crypto: marvell/octeontx - clean up VF resources when DOWN fails
A failed DOWN mailbox notification makes otx_cptvf_remove() skip all local cleanup. The driver core still completes unbind and releases the devm-allocated cptvf, leaving the raw IRQ handlers registered with that object as their argument. The sysfs group, crypto device-table entry, software queues and PCI resources also remain uncleaned.
Keep the notification error diagnostic, but run the existing local cleanup regardless of the PF response. This removes both IRQ handlers before killing the tasklet and releasing its resources, as on the successful notification path.
This issue was identified during our ongoing static-analysis research while reviewing kernel code.
--- .../crypto/marvell/octeontx/otx_cptvf_main.c | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-)
drivers/crypto/marvell/octeontx/otx_cptvf_main.c +14 -15
@@ -937,22 +937,21 @@ static void otx_cptvf_remove(struct pci_dev *pdev) }/* Convey DOWN to PF */ -if (otx_cptvf_send_vf_down (cptvf)) { +if (otx_cptvf_send_vf_down (cptvf))dev_err (&pdev->dev,"PF not responding to DOWN msg\n" ); - }else { -sysfs_remove_group (&pdev->dev.kobj, &otx_cptvf_sysfs_group); -otx_cpt_crypto_exit (pdev,THIS_MODULE , cptvf->vftype); -cptvf_free_irq_affinity (cptvf,CPT_VF_INT_VEC_E_DONE ); -cptvf_free_irq_affinity (cptvf,CPT_VF_INT_VEC_E_MISC ); -free_irq (pci_irq_vector (pdev,CPT_VF_INT_VEC_E_DONE ), cptvf); -free_irq (pci_irq_vector (pdev,CPT_VF_INT_VEC_E_MISC ), cptvf); -cptvf_sw_cleanup (cptvf); -pci_free_irq_vectors (cptvf->pdev); -pci_iounmap (pdev, cptvf->reg_base); -pci_release_regions (pdev); -pci_disable_device (pdev); -pci_set_drvdata (pdev,NULL ); - } + +sysfs_remove_group (&pdev->dev.kobj, &otx_cptvf_sysfs_group); +otx_cpt_crypto_exit (pdev,THIS_MODULE , cptvf->vftype); +cptvf_free_irq_affinity (cptvf,CPT_VF_INT_VEC_E_DONE ); +cptvf_free_irq_affinity (cptvf,CPT_VF_INT_VEC_E_MISC ); +free_irq (pci_irq_vector (pdev,CPT_VF_INT_VEC_E_DONE ), cptvf); +free_irq (pci_irq_vector (pdev,CPT_VF_INT_VEC_E_MISC ), cptvf); +cptvf_sw_cleanup (cptvf); +pci_free_irq_vectors (cptvf->pdev); +pci_iounmap (pdev, cptvf->reg_base); +pci_release_regions (pdev); +pci_disable_device (pdev); +pci_set_drvdata (pdev,NULL ); }/* Supported devices */
Signature · 1 line
2.53.0
Herbert Xu
maintainerQuoted 20 lines · Myeonghun Pak
A failed DOWN mailbox notification makes
otx_cptvf_remove()skip all local cleanup. The driver core still completes unbind and releases the devm-allocated cptvf, leaving the raw IRQ handlers registered with that object as their argument. The sysfs group, crypto device-table entry, software queues and PCI resources also remain uncleaned.Keep the notification error diagnostic, but run the existing local cleanup regardless of the PF response. This removes both IRQ handlers before killing the tasklet and releasing its resources, as on the successful notification path.
This issue was identified during our ongoing static-analysis research while reviewing kernel code.
Fixes 10b4f09491bf ("crypto: marvell - add the Virtual Function driver for CPT")Assisted-by LLMCo-developed-by Ijae Kim <[email protected]>Signed-off-by Ijae Kim <[email protected]>Signed-off-by Myeonghun Pak <[email protected]>
Quoted 3 lines
--- .../crypto/marvell/octeontx/otx_cptvf_main.c | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-)
Please check
https://sashiko.dev/#/patchset/20261004042634.1130247-1-mhun512%40gmail.com
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