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:   Sat, 16 Apr 2022 14:53:44 +0300
From:   Pavel Skripkin <paskripkin@...il.com>
To:     David Kahurani <k.kahurani@...il.com>
Cc:     netdev@...r.kernel.org,
        syzbot <syzbot+d3dbdf31fbe9d8f5f311@...kaller.appspotmail.com>,
        davem@...emloft.net, jgg@...pe.ca, kuba@...nel.org,
        linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org,
        Phillip Potter <phil@...lpotter.co.uk>,
        syzkaller-bugs@...glegroups.com, arnd@...db.de,
        Dan Carpenter <dan.carpenter@...cle.com>
Subject: Re: [PATCH] net: ax88179: add proper error handling of usb read
 errors

Hi David,

On 4/16/22 14:49, David Kahurani wrote:
>> > @@ -1303,8 +1448,12 @@ static void ax88179_get_mac_addr(struct usbnet *dev)
>> >               netif_dbg(dev, ifup, dev->net,
>> >                         "MAC address read from device tree");
>> >       } else {
>> > -             ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_NODE_ID, ETH_ALEN,
>> > -                              ETH_ALEN, mac);
>> > +             ret = ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_NODE_ID, ETH_ALEN,
>> > +                                    ETH_ALEN, mac);
>> > +
>> > +             if (ret)
>> > +                     netdev_dbg(dev->net, "Failed to read NODE_ID: %d", ret);
>> > +
>> >               netif_dbg(dev, ifup, dev->net,
>> >                         "MAC address read from ASIX chip");
>> >       }
>>
>>
>> This message sequence is confusing.
>>
>> In case of ax88179_read_cmd() failure mac read from device actually
>> failed, but message says, that it was successfully finished.
> 
> I suppose the code should return in case of an error that way the next
> message does not get executed.
> 

No, this will break the driver. This function should set mac address in 
netdev structure and if read from device fails code calls

	eth_hw_addr_set(dev->net, mac);

which will generate random mac addr. I.e. read failure is not critical 
in that function

So, no need to return with an error, just don't print confusing messages :)




With regards,
Pavel Skripkin

Download attachment "OpenPGP_signature" of type "application/pgp-signature" (841 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ