ice: fix potential double free in probe unrolling
[ Upstream commit bc3a024101
]
If ice_init_interrupt_scheme fails, ice_probe will jump to clearing up
the interrupts. This can lead to some static analysis tools such as the
compiler sanitizers complaining about double free problems.
Since ice_init_interrupt_scheme already unrolls internally on failure,
there is no need to call ice_clear_interrupt_scheme when it fails. Add
a new unroll label and use that instead.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
62b2fbb9c4
commit
99ea968e37
@ -2900,7 +2900,7 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent)
|
|||||||
if (err) {
|
if (err) {
|
||||||
dev_err(dev, "ice_init_interrupt_scheme failed: %d\n", err);
|
dev_err(dev, "ice_init_interrupt_scheme failed: %d\n", err);
|
||||||
err = -EIO;
|
err = -EIO;
|
||||||
goto err_init_interrupt_unroll;
|
goto err_init_vsi_unroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Driver is mostly up */
|
/* Driver is mostly up */
|
||||||
@ -2986,6 +2986,7 @@ err_msix_misc_unroll:
|
|||||||
ice_free_irq_msix_misc(pf);
|
ice_free_irq_msix_misc(pf);
|
||||||
err_init_interrupt_unroll:
|
err_init_interrupt_unroll:
|
||||||
ice_clear_interrupt_scheme(pf);
|
ice_clear_interrupt_scheme(pf);
|
||||||
|
err_init_vsi_unroll:
|
||||||
devm_kfree(dev, pf->vsi);
|
devm_kfree(dev, pf->vsi);
|
||||||
err_init_pf_unroll:
|
err_init_pf_unroll:
|
||||||
ice_deinit_pf(pf);
|
ice_deinit_pf(pf);
|
||||||
|
Reference in New Issue
Block a user