netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: Alok Tiwari <alok.a.tiwari@oracle.com>, <sgoutham@marvell.com>,
	<andrew+netdev@lunn.ch>, <davem@davemloft.net>,
	<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<horms@kernel.org>, <netdev@vger.kernel.org>
Cc: <linux-arm-kernel@lists.infradead.org>, <darren.kenny@oracle.com>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net v3] net: thunderx: avoid direct MTU assignment after WRITE_ONCE()
Date: Wed, 9 Jul 2025 15:35:25 -0700	[thread overview]
Message-ID: <e6152ac2-47b2-4ddc-8adc-bc4279c21d40@intel.com> (raw)
In-Reply-To: <20250706194327.1369390-1-alok.a.tiwari@oracle.com>


[-- Attachment #1.1: Type: text/plain, Size: 1100 bytes --]



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@oracle.com>
> ---
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

  reply	other threads:[~2025-07-09 22:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-06 19:43 [PATCH net v3] net: thunderx: avoid direct MTU assignment after WRITE_ONCE() Alok Tiwari
2025-07-09 22:35 ` Jacob Keller [this message]
2025-07-10  2:30 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e6152ac2-47b2-4ddc-8adc-bc4279c21d40@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=alok.a.tiwari@oracle.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=darren.kenny@oracle.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sgoutham@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).