1 |
From 41db6dab8a567b55c4f7d8329d6f24e38ab6d6d0 Mon Sep 17 00:00:00 2001 |
2 |
From: Sasha Levin <sashal@kernel.org> |
3 |
Date: Tue, 23 Aug 2022 10:46:58 -0700 |
4 |
Subject: net: Fix a data-race around gro_normal_batch. |
5 |
|
6 |
From: Kuniyuki Iwashima <kuniyu@amazon.com> |
7 |
|
8 |
[ Upstream commit 8db24af3f02ebdbf302196006ebb270c4c3a2706 ] |
9 |
|
10 |
While reading gro_normal_batch, it can be changed concurrently. |
11 |
Thus, we need to add READ_ONCE() to its reader. |
12 |
|
13 |
Fixes: 323ebb61e32b ("net: use listified RX for handling GRO_NORMAL skbs") |
14 |
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com> |
15 |
Acked-by: Edward Cree <ecree.xilinx@gmail.com> |
16 |
Signed-off-by: David S. Miller <davem@davemloft.net> |
17 |
Signed-off-by: Sasha Levin <sashal@kernel.org> |
18 |
--- |
19 |
include/net/gro.h | 2 +- |
20 |
1 file changed, 1 insertion(+), 1 deletion(-) |
21 |
|
22 |
diff --git a/include/net/gro.h b/include/net/gro.h |
23 |
index 867656b0739c0..24003dea8fa4d 100644 |
24 |
--- a/include/net/gro.h |
25 |
+++ b/include/net/gro.h |
26 |
@@ -439,7 +439,7 @@ static inline void gro_normal_one(struct napi_struct *napi, struct sk_buff *skb, |
27 |
{ |
28 |
list_add_tail(&skb->list, &napi->rx_list); |
29 |
napi->rx_count += segs; |
30 |
- if (napi->rx_count >= gro_normal_batch) |
31 |
+ if (napi->rx_count >= READ_ONCE(gro_normal_batch)) |
32 |
gro_normal_list(napi); |
33 |
} |
34 |
|
35 |
-- |
36 |
2.35.1 |
37 |
|