[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e6152ac2-47b2-4ddc-8adc-bc4279c21d40@intel.com>
Date: Wed, 9 Jul 2025 15:35:25 -0700
From: Jacob Keller <jacob.e.keller@...el.com>
To: Alok Tiwari <alok.a.tiwari@...cle.com>, <sgoutham@...vell.com>,
<andrew+netdev@...n.ch>, <davem@...emloft.net>, <edumazet@...gle.com>,
<kuba@...nel.org>, <pabeni@...hat.com>, <horms@...nel.org>,
<netdev@...r.kernel.org>
CC: <linux-arm-kernel@...ts.infradead.org>, <darren.kenny@...cle.com>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net v3] net: thunderx: avoid direct MTU assignment after
WRITE_ONCE()
On 7/6/2025 12:43 PM, Alok Tiwari wrote:
> The current logic in nicvf_change_mtu() writes the new MTU to
> netdev->mtu using WRITE_ONCE() before verifying if the hardware
> update succeeds. However on hardware update failure, it attempts
> to revert to the original MTU using a direct assignment
> (netdev->mtu = orig_mtu)
> which violates the intended of WRITE_ONCE protection introduced in
> commit 1eb2cded45b3 ("net: annotate writes on dev->mtu from
> ndo_change_mtu()")
>
> Additionally, WRITE_ONCE(netdev->mtu, new_mtu) is unnecessarily
> performed even when the device is not running.
>
> Fix this by:
> Only writing netdev->mtu after successfully updating the hardware.
> Skipping hardware update when the device is down, and setting MTU
> directly. Remove unused variable orig_mtu.
>
> This ensures that all writes to netdev->mtu are consistent with
> WRITE_ONCE expectations and avoids unintended state corruption
> on failure paths.
>
> Signed-off-by: Alok Tiwari <alok.a.tiwari@...cle.com>
> ---
Reviewed-by: Jacob Keller <jacob.e.keller@...el.com>
Download attachment "OpenPGP_signature.asc" of type "application/pgp-signature" (237 bytes)
Powered by blists - more mailing lists