+Matthias Brugger <[email protected]>

Hi Graeme,

On 2026-08-06T20:43:42, Graeme Smecher <[email protected]> wrote:
> net: srand_mac(): fix -ENODEV crash with CONFIG_DM_RNG
>
> The uclass_get_device() return-value check was inverted, resulting in a
> synchronous abort when -ENODEV was returned.

Good catch. This also means the RNG path has never worked: with the
inverted check, dm_rng_read() was only called when uclass_get_device()
failed, using an uninitialised devp, hence the abort. Boards with a working
RNG silently fell back to the MAC seed. You could mention that in the
commit message. I believe it is:

Fixes: ea707dc0aaaf ("net: Use NDRNG device in srand_mac()")

>
> Signed-off-by: Graeme Smecher <[email protected]>
>
> net/net_rand.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

> diff --git a/net/net_rand.h b/net/net_rand.h
> @@ -44,7 +44,7 @@ static inline void srand_mac(void)
> -             if (ret) {
> +             if (!ret) {

Reviewed-by: Simon Glass <[email protected]>

Regards,
Simon

Reply via email to