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]
Message-ID: <2380c655-a6ba-7cdb-06d1-9c7856ff6cce@gmail.com>
Date:   Mon, 12 Sep 2022 11:14:42 -0700
From:   Florian Fainelli <f.fainelli@...il.com>
To:     Dan Carpenter <dan.carpenter@...cle.com>,
        Yu Zhe <yuzhe@...china.com>
Cc:     rafal@...ecki.pl, bcm-kernel-feedback-list@...adcom.com,
        davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
        pabeni@...hat.com, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
        liqiong@...china.com
Subject: Re: [PATCH] net: broadcom: bcm4908enet: add platform_get_irq_byname
 error checking

On 9/12/22 04:29, Dan Carpenter wrote:
> On Fri, Sep 09, 2022 at 02:25:45PM +0800, Yu Zhe wrote:
>> The platform_get_irq_byname() function returns negative error codes on error,
>> check it.
>>
>> Signed-off-by: Yu Zhe <yuzhe@...china.com>
>> ---
>>   drivers/net/ethernet/broadcom/bcm4908_enet.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/broadcom/bcm4908_enet.c b/drivers/net/ethernet/broadcom/bcm4908_enet.c
>> index c131d8118489..d985056db6c2 100644
>> --- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
>> +++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
>> @@ -705,6 +705,8 @@ static int bcm4908_enet_probe(struct platform_device *pdev)
>>   		return netdev->irq;
>>   
>>   	enet->irq_tx = platform_get_irq_byname(pdev, "tx");
>> +	if (enet->irq_tx < 0)
>> +		return enet->irq_tx;
>>   
> 
> If you read the driver, then you will see that this is deliberate.
> Search for irq_tx and read the comments.  I'm not a subsystem expert so
> I don't know if this an ideal way to write the code, but it's done
> deliberately so please don't change it unless you can test it.

Yup, the transmit interrupt is deemed optional, or at least was up to 
some point during the driver development. There is however a worthy bug 
you could fix:

   static int bcm4908_enet_stop(struct net_device *netdev)
   {
           struct bcm4908_enet *enet = netdev_priv(netdev);
           struct bcm4908_enet_dma_ring *tx_ring = &enet->tx_ring;
           struct bcm4908_enet_dma_ring *rx_ring = &enet->rx_ring;

           netif_stop_queue(netdev);
           netif_carrier_off(netdev);
           napi_disable(&rx_ring->napi);
           napi_disable(&tx_ring->napi);

           bcm4908_enet_dma_rx_ring_disable(enet, &enet->rx_ring);
           bcm4908_enet_dma_tx_ring_disable(enet, &enet->tx_ring);

           bcm4908_enet_dma_uninit(enet);

           free_irq(enet->irq_tx, enet);

We might attempt to free an invalid interrupt here ^^

           free_irq(enet->netdev->irq, enet);

           return 0;
-- 
Florian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ