lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 06 May 2014 17:34:38 +0200
From:	Nikolay Aleksandrov <nikolay@...hat.com>
To:	netdev@...r.kernel.org
CC:	Nikolay Aleksandrov <nikolay@...hat.com>,
	linux-net-drivers@...arflare.com,
	Shradha Shah <sshah@...arflare.com>,
	"David S. Miller" <davem@...emloft.net>,
	Ben Hutchings <ben@...adent.org.uk>
Subject: Re: [PATCH net] sfc: fix calling of free_irq with 0 argument

On 05/06/2014 02:49 PM, Nikolay Aleksandrov wrote:
> 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 irq 0
> in efx_nic_fini_interrupt() since the MSI interrupts were freed always,
> but in legacy irq mode they're == 0. So fix it by checking if we
> actually have an interrupt allocated and only then free it.
> 
> CC: <linux-net-drivers@...arflare.com>
> CC: Shradha Shah <sshah@...arflare.com>
> CC: David S. Miller <davem@...emloft.net>
> 
> Reported-by: Zenghui Shi <zshi@...hat.com>
> Signed-off-by: Nikolay Aleksandrov <nikolay@...hat.com>
> ---
> There're other ways to fix this as well, but I chose this one as it follows
> the logic in the code. Also I saw it used in a few places to check if
> there's an IRQ allocated for that channel.
> 
>  drivers/net/ethernet/sfc/nic.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/sfc/nic.c b/drivers/net/ethernet/sfc/nic.c
> index 32d969e857f7..cab627defbc3 100644
> --- a/drivers/net/ethernet/sfc/nic.c
> +++ b/drivers/net/ethernet/sfc/nic.c
> @@ -158,7 +158,9 @@ void efx_nic_fini_interrupt(struct efx_nic *efx)
>  
>  	/* Disable MSI/MSI-X interrupts */
>  	efx_for_each_channel(channel, efx)
> -		free_irq(channel->irq, &efx->msi_context[channel->channel]);
> +		if (channel->irq)
> +			free_irq(channel->irq,
> +				 &efx->msi_context[channel->channel]);
>  
>  	/* Disable legacy interrupt */
>  	if (efx->legacy_irq)
> 
And of course if I had looked deeper in the history of that function I would've
seen that the code was like that before commit
1899c111a535e43046b14ae13639747d9d2544d6 ("sfc: Fix IRQ cleanup in case of a
probe failure"). So including Ben on the CC list as he's the author of that commit.

Cheers,
 Nik
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists