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: <20250325114611.4ac846b6@mitra>
Date: Tue, 25 Mar 2025 11:46:11 +0100
From: Benedikt Spranger <b.spranger@...utronix.de>
To: Roger Quadros <rogerq@...nel.org>
Cc: netdev@...r.kernel.org, MD Danish Anwar <danishanwar@...com>, Andrew
 Lunn <andrew+netdev@...n.ch>
Subject: Re: [PATCH] net: ti: icssg-prueth: Check return value to avoid a
 kernel oops

On Mon, 24 Mar 2025 16:44:20 +0200
Roger Quadros <rogerq@...nel.org> wrote:

> On 23/03/2025 17:18, Benedikt Spranger wrote:
> > On Sun, 23 Mar 2025 09:19:35 +0200
> > Roger Quadros <rogerq@...nel.org> wrote:
> >   
> >> Did you actually get a kernel oops?  
> > Yes. And I would like to attach the kernel output, but I do not have
> > access to the board ATM.
> >   
> >> If yes, which part of code produces the oops.  
> > I get an NULL pointer dereference in is_multicast_ether_addr().
> > It happens here:
> > 
> >     u32 a = *(const u32 *)addr;  
> 
> But this should not happen. Because ndev->addr (pointer) should not
> be zero. Driver allocated ndev with alloc_etherdev_mq() which
> allocates memory for ndev->addr using dev_addr_init(dev)).
Emphasis on *should* :)
OK, got your point. Dig deeper into that.

> >> Even if it fails we do set a random MAC address and do not return
> >> error. So above statement is false.  
> > I doubt that. of_get_ethdev_address() do not set a random MAC
> > address in case of a failure. It simply returns -ENODEV. Since
> > is_valid_ether_addr() fails with a NULL pointer dereference in
> > is_multicast_ether_addr() on the other hand, no random MAC address
> > is set.   
> 
> What I meant was we set random address using eth_hw_addr_random().
But that happens after the failing check. So evaluating the return of
of_get_ethdev_address() seem to be a good thing in the first place.

I my understanding (for now) it is nessesary to check both: the return
of of_get_ethdev_address() *and* !is_valid_ether_addr(). If any of these
checks fail eth_hw_addr_random() should be called and therefore a
random MAC address be set.

Regards
    Bene

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ