diff options
author | Kuniyuki Iwashima <kuniyu@amazon.com> | 2022-08-23 20:46:45 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-08-31 18:18:08 +0300 |
commit | 01198bebd53e21a139f7d8eacd190f262fbd66eb (patch) | |
tree | c14d5d9b253a35db394f6eafb8d1fb3b52097391 /net/core/dev.c | |
parent | a9de312f45141ffff8f618a528b183e468154aef (diff) | |
download | linux-01198bebd53e21a139f7d8eacd190f262fbd66eb.tar.xz |
net: Fix data-races around weight_p and dev_weight_[rt]x_bias.
[ Upstream commit bf955b5ab8f6f7b0632cdef8e36b14e4f6e77829 ]
While reading weight_p, it can be changed concurrently. Thus, we need
to add READ_ONCE() to its reader.
Also, dev_[rt]x_weight can be read/written at the same time. So, we
need to use READ_ONCE() and WRITE_ONCE() for its access. Moreover, to
use the same weight_p while changing dev_[rt]x_weight, we add a mutex
in proc_do_dev_weight().
Fixes: 3d48b53fb2ae ("net: dev_weight: TX/RX orthogonality")
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r-- | net/core/dev.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 30a1603a7225..2a7d81cd9e2e 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -5917,7 +5917,7 @@ static int process_backlog(struct napi_struct *napi, int quota) net_rps_action_and_irq_enable(sd); } - napi->weight = dev_rx_weight; + napi->weight = READ_ONCE(dev_rx_weight); while (again) { struct sk_buff *skb; |