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: <3bd78b6a-3c6d-4130-b086-36f2f728bc3e@kernel.org>
Date: Mon, 24 Mar 2025 16:44:20 +0200
From: Roger Quadros <rogerq@...nel.org>
To: Benedikt Spranger <b.spranger@...utronix.de>
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 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)).

> 
>> 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().

> 
>>> Check the return value of of_get_ethdev_address() before validating
>>> the MAC address.  
>>
>> If of_get_ethdev_address() fails the netdev address will remain zero
>> (as it was zero initialized during allocation) so
>> is_valid_ether_addr() will fail as well.
> Yes. It will fail to. But is_valid_ether_addr() is not called any more.
> 
> Due to the if statement is_valid_ether_addr() is only called, if
> of_get_ethdev_address() exits with 0 aka success. In case of a failure
> the if statement is true and there is no call to is_valid_ether_addr().
> 
> Regards
>     Bene

-- 
cheers,
-roger


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ