]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: Fix a data-race around netdev_budget_usecs.
authorKuniyuki Iwashima <kuniyu@amazon.com>
Tue, 23 Aug 2022 17:46:55 +0000 (10:46 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 24 Aug 2022 12:46:58 +0000 (13:46 +0100)
While reading netdev_budget_usecs, it can be changed concurrently.
Thus, we need to add READ_ONCE() to its reader.

Fixes: 74cb56bd48c3 ("Replace 2 jiffies with sysctl netdev_budget_usecs to enable softirq tuning")
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/dev.c

index c83e23cfc57d7ff8b60efc1891601230a9997a11..8221322d86db9c012d40d2c83e58c2dd51db334d 100644 (file)
@@ -6665,7 +6665,7 @@ static __latent_entropy void net_rx_action(struct softirq_action *h)
 {
        struct softnet_data *sd = this_cpu_ptr(&softnet_data);
        unsigned long time_limit = jiffies +
-               usecs_to_jiffies(netdev_budget_usecs);
+               usecs_to_jiffies(READ_ONCE(netdev_budget_usecs));
        int budget = READ_ONCE(netdev_budget);
        LIST_HEAD(list);
        LIST_HEAD(repoll);