sfc: fix calling of free_irq with already free vector
Subsystems (3)
PATCH v3 1/1 sfc: fix calling of free_irq with already free vector
If the sfc driver is in legacy interrupt mode (either explicitly by using interrupt_mode module param or by falling back to it) it will hit a warning at kernel/irq/manage.c because it will try to free an irq which wasn't allocated by it in the first place because the MSI(X) irqs are zero and it'll try to free them unconditionally. So fix it by checking if we're in legacy mode and freeing the appropriate irqs.
---
v3: Use the EFX_INT_MODE_USE_MSI macro instead of direct check as suggested by Ben
v2: Change the fix to check for the interrupt mode and adjust the commit message.
drivers/net/ethernet/sfc/nic.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/net/ethernet/sfc/nic.c +8 -6
@@ -156,13 +156,15 @@ void efx_nic_fini_interrupt(struct efx_nic *efx) efx->net_dev->rx_cpu_rmap =NULL ;#endif -/* Disable MSI/MSI-X interrupts */ -efx_for_each_channel (channel, efx) -free_irq (channel->irq, &efx->msi_context[channel->channel]); - -/* Disable legacy interrupt */ -if (efx->legacy_irq) +if (EFX_INT_MODE_USE_MSI (efx)) { +/* Disable MSI/MSI-X interrupts */ +efx_for_each_channel (channel, efx) +free_irq (channel->irq, + &efx->msi_context[channel->channel]); + }else { +/* Disable legacy interrupt */ free_irq (efx->legacy_irq, efx); + } }/* Register dump */
Signature · 1 line
1.8.5.3
Quoted 13 lines · Nikolay Aleksandrov
If the sfc driver is in legacy interrupt mode (either explicitly by using
interrupt_modemodule param or by falling back to it) it will hit a warning atkernel/irq/manage.cbecause it will try to free an irq which wasn't allocated by it in the first place because the MSI(X) irqs are zero and it'll try to free them unconditionally. So fix it by checking if we're in legacy mode and freeing the appropriate irqs.CC Zenghui Shi <[email protected]>CC Ben Hutchings <[email protected]>CC <[email protected]>CC Shradha Shah <[email protected]>CC David S. Miller <[email protected]>
Quoted 3 lines
Fixes 1899c111a535 ("sfc: Fix IRQ cleanup in case of a probe failure")Reported-by Zenghui Shi <[email protected]>Signed-off-by Nikolay Aleksandrov <[email protected]>
Quoted 26 lines
---
v3: Use theEFX_INT_MODE_USE_MSImacro instead of direct check as suggested by Ben
v2: Change the fix to check for the interrupt mode and adjust the commit message.drivers/net/ethernet/sfc/nic.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)drivers/net/ethernet/sfc/nic.c +2
-6@@ -156,13 +156,15 @@ void efx_nic_fini_interrupt(struct efx_nic *efx) efx->net_dev->rx_cpu_rmap =NULL ;#endif -/* Disable MSI/MSI-X interrupts */ -efx_for_each_channel (channel, efx) -free_irq (channel->irq, &efx->msi_context[channel->channel]); - -/* Disable legacy interrupt */ -if (efx->legacy_irq) +if (EFX_INT_MODE_USE_MSI (efx)) { +/* Disable MSI/MSI-X interrupts */
drivers/net/ethernet/sfc/nic.c void efx_nic_fini_interrupt(struct efx_nic *efx) · line 170
Quoted 10 lines
drivers/net/ethernet/sfc/nic.c +6
-0+efx_for_each_channel (channel, efx) +free_irq (channel->irq, + &efx->msi_context[channel->channel]); + }else { +/* Disable legacy interrupt */ free_irq (efx->legacy_irq, efx); + } }/* Register dump */
The information contained in this message is confidential and is intended for the addressee(s) only. If you have received this message in error, please notify the sender immediately and delete the message. Unless you are an addressee (or authorized to receive for an addressee), you may not use, copy or disclose to anyone this message or any information contained in this message. The unauthorized use, disclosure, copying or alteration of this message is strictly prohibited.
David Miller
maintainerFrom: Nikolay Aleksandrov <[email protected]>
Date: Fri, 9 May 2014 11:11:39 +0200
Quoted 13 lines
If the sfc driver is in legacy interrupt mode (either explicitly by using
interrupt_modemodule param or by falling back to it) it will hit a warning atkernel/irq/manage.cbecause it will try to free an irq which wasn't allocated by it in the first place because the MSI(X) irqs are zero and it'll try to free them unconditionally. So fix it by checking if we're in legacy mode and freeing the appropriate irqs.CC Zenghui Shi <[email protected]>CC Ben Hutchings <[email protected]>CC <[email protected]>CC Shradha Shah <[email protected]>CC David S. Miller <[email protected]>
Quoted 8 lines
Fixes 1899c111a535 ("sfc: Fix IRQ cleanup in case of a probe failure")Reported-by Zenghui Shi <[email protected]>Signed-off-by Nikolay Aleksandrov <[email protected]>---
v3: Use theEFX_INT_MODE_USE_MSImacro instead of direct check as suggested by Ben
v2: Change the fix to check for the interrupt mode and adjust the commit message.
Applied and queued up for -stable, thanks Nikolay.