aboutsummaryrefslogtreecommitdiffstats
path: root/rust/helpers/cpu.c
diff options
context:
space:
mode:
authorAlok Tiwari <[email protected]>2025-07-06 19:43:21 +0000
committerJakub Kicinski <[email protected]>2025-07-10 02:12:07 +0000
commit849704b8b2115647e12436e5076b8e7a4944f21a (patch)
tree39fc2cf943af62ee77ec5ee35d0039726a08f978 /rust/helpers/cpu.c
parentselftests/tc-testing: Create test case for UAF scenario with DRR/NETEM/BLACKH... (diff)
downloadkernel-849704b8b2115647e12436e5076b8e7a4944f21a.tar.gz
kernel-849704b8b2115647e12436e5076b8e7a4944f21a.zip
net: thunderx: avoid direct MTU assignment after WRITE_ONCE()
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 <[email protected]> Reviewed-by: Jacob Keller <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'rust/helpers/cpu.c')
0 files changed, 0 insertions, 0 deletions