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] [day] [month] [year] [list]
Message-ID: <f59200c5-c720-fe66-f395-31ea096dc300@wanadoo.fr>
Date:   Tue, 17 May 2022 22:12:26 +0200
From:   Christophe JAILLET <christophe.jaillet@...adoo.fr>
To:     Paolo Abeni <pabeni@...hat.com>,
        Dan Carpenter <dan.carpenter@...cle.com>
Cc:     Veerasenareddy Burru <vburru@...vell.com>,
        Abhijit Ayarekar <aayarekar@...vell.com>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Satananda Burla <sburla@...vell.com>,
        linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
        netdev@...r.kernel.org
Subject: Re: [PATCH 2/2] octeon_ep: Fix irq releasing in the error handling
 path of octep_request_irqs()

Le 17/05/2022 à 10:35, Paolo Abeni a écrit :
> On Tue, 2022-05-17 at 08:28 +0300, Dan Carpenter wrote:
>> On Sun, May 15, 2022 at 05:56:45PM +0200, Christophe JAILLET wrote:
>>> For the error handling to work as expected, the index in the
>>> 'oct->msix_entries' array must be tweaked because, when the irq are
>>> requested there is:
>>> 	msix_entry = &oct->msix_entries[i + num_non_ioq_msix];
>>>
>>> So in the error handling path, 'i + num_non_ioq_msix' should be used
>>> instead of 'i'.
>>>
>>> The 2nd argument of free_irq() also needs to be adjusted.
>>>
>>> Fixes: 37d79d059606 ("octeon_ep: add Tx/Rx processing and interrupt support")
>>> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
>>> ---
>>> I think that the wording above is awful, but I'm sure you get it.
>>> Feel free to rephrase everything to have it more readable.
>>> ---
>>>   drivers/net/ethernet/marvell/octeon_ep/octep_main.c | 4 +++-
>>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c
>>> index 6b60a03574a0..4dcae805422b 100644
>>> --- a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c
>>> +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c
>>> @@ -257,10 +257,12 @@ static int octep_request_irqs(struct octep_device *oct)
>>>   
>>>   	return 0;
>>>   ioq_irq_err:
>>> +	i += num_non_ioq_msix;
>>>   	while (i > num_non_ioq_msix) {
>>
>> This makes my mind hurt so badly.  Can we not just have two variables
>> for the two different loops instead of re-using i?
>>
>>>   		--i;
>>>   		irq_set_affinity_hint(oct->msix_entries[i].vector, NULL);
>>> -		free_irq(oct->msix_entries[i].vector, oct->ioq_vector[i]);
>>> +		free_irq(oct->msix_entries[i].vector,
>>> +			 oct->ioq_vector[i - num_non_ioq_msix]);
>>>   	}
>>
>> ioq_irq_err:
>>          while (--j >= 0) {
>>                  ioq_vector = oct->ioq_vector[j];
>>                  msix_entry = &oct->msix_entries[j + num_non_ioq_msix];
>>
>>                  irq_set_affinity_hint(msix_entry->vector, NULL);
>>                  free_irq(msix_entry->vector, ioq_vector);
>>          }
>>
>> regards,
>> dan carpenter
> 
> I agree the above would be more readable. @Christophe: could you please
> refactor the code as per Dan's suggestion?

Will do.

I was sure that Dan would comment on this unusual pattern :)

CJ

> 
> Thanks!
> 
> Paolo
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ