diff mbox series

net: ethernet: mtk_eth_soc: Reuse value using READ_ONCE instead of re-rereading it

Message ID tencent_C699E9540505523424F11A9BD3D21B86840A@qq.com (mailing list archive)
State Accepted
Commit 04172043bd218dbbfc0c13bd4630142eb3f027cb
Delegated to: Netdev Maintainers
Headers show
Series net: ethernet: mtk_eth_soc: Reuse value using READ_ONCE instead of re-rereading it | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 943 this patch: 943
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 12 of 12 maintainers
netdev/build_clang success Errors and warnings before: 954 this patch: 954
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 954 this patch: 954
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-04-03--09-00 (tests: 950)

Commit Message

linke li April 3, 2024, 2:54 a.m. UTC
In mtk_flow_entry_update_l2, the hwe->ib1 is read using READ_ONCE at the
beginning of the function, checked, and then re-read from hwe->ib1,
may void all guarantees of the checks. Reuse the value that was read by
READ_ONCE to ensure the consistency of the ib1 throughout the function.

Signed-off-by: linke li <lilinke99@qq.com>
---
 drivers/net/ethernet/mediatek/mtk_ppe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

patchwork-bot+netdevbpf@kernel.org April 4, 2024, 1:50 p.m. UTC | #1
Hello:

This patch was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Wed,  3 Apr 2024 10:54:00 +0800 you wrote:
> In mtk_flow_entry_update_l2, the hwe->ib1 is read using READ_ONCE at the
> beginning of the function, checked, and then re-read from hwe->ib1,
> may void all guarantees of the checks. Reuse the value that was read by
> READ_ONCE to ensure the consistency of the ib1 throughout the function.
> 
> Signed-off-by: linke li <lilinke99@qq.com>
> 
> [...]

Here is the summary with links:
  - net: ethernet: mtk_eth_soc: Reuse value using READ_ONCE instead of re-rereading it
    https://git.kernel.org/netdev/net-next/c/04172043bd21

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c b/drivers/net/ethernet/mediatek/mtk_ppe.c
index b2a5d9c3733d..8b3cdfc4d407 100644
--- a/drivers/net/ethernet/mediatek/mtk_ppe.c
+++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
@@ -580,7 +580,7 @@  mtk_flow_entry_update_l2(struct mtk_ppe *ppe, struct mtk_flow_entry *entry)
 
 		idle = cur_idle;
 		entry->data.ib1 &= ~ib1_ts_mask;
-		entry->data.ib1 |= hwe->ib1 & ib1_ts_mask;
+		entry->data.ib1 |= ib1 & ib1_ts_mask;
 	}
 }