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: <20250630111836.GE41770@horms.kernel.org>
Date: Mon, 30 Jun 2025 12:18:36 +0100
From: Simon Horman <horms@...nel.org>
To: Alok Tiwari <alok.a.tiwari@...cle.com>
Cc: sgoutham@...vell.com, andrew+netdev@...n.ch, davem@...emloft.net,
	edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
	netdev@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH net v2] net: thunderx: avoid direct MTU assignment after
 WRITE_ONCE()

On Sat, Jun 28, 2025 at 10:15:37PM -0700, Alok Tiwari wrote:

...

> @@ -1589,16 +1588,18 @@ static int nicvf_change_mtu(struct net_device *netdev, int new_mtu)
>  		return -EINVAL;
>  	}
>  
> -	WRITE_ONCE(netdev->mtu, new_mtu);
>  
> -	if (!netif_running(netdev))
> +	if (!netif_running(netdev)) {
> +		WRITE_ONCE(netdev->mtu, new_mtu);
>  		return 0;
> +	}
>  
>  	if (nicvf_update_hw_max_frs(nic, new_mtu)) {
> -		netdev->mtu = orig_mtu;
>  		return -EINVAL;
>  	}

nit: curly brackets should be removed here, but see further comment below.

>  
> +	WRITE_ONCE(netdev->mtu, new_mtu);
> +
>  	return 0;
>  }

Could this be more succinctly expressed as follows?
(Completely untested!)

	if (netif_running(netdev) && nicvf_update_hw_max_frs(nic, new_mtu))
		return -ENIVAL;

	WRITE_ONCE(netdev->mtu, new_mtu);

	return 0;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ