All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Vyukov <dvyukov@google.com>
To: Kuniyuki Iwashima <kuniyu@amazon.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Kuniyuki Iwashima <kuni1840@gmail.com>,
	netdev@vger.kernel.org, Marco Elver <elver@google.com>
Subject: Re: [PATCH v2 net 16/17] net: Fix a data-race around netdev_unregister_timeout_secs.
Date: Thu, 18 Aug 2022 08:53:23 +0200	[thread overview]
Message-ID: <CACT4Y+YJZyfrea7VxHt3varEE0jqJn-d9jaNeE-NXSAXOfi8Ew@mail.gmail.com> (raw)
In-Reply-To: <20220818035227.81567-17-kuniyu@amazon.com>

On Thu, 18 Aug 2022 at 05:57, Kuniyuki Iwashima <kuniyu@amazon.com> wrote:
>
> While reading netdev_unregister_timeout_secs, it can be changed
> concurrently.  Thus, we need to add READ_ONCE() to its reader.
>
> Fixes: 5aa3afe107d9 ("net: make unregister netdev warning timeout configurable")
> Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
> ---
> CC: Dmitry Vyukov <dvyukov@google.com>

Thanks, Kuniyuki.
RIght, since it is a sysctl it can be changed concurrently.

Acked-by: Dmitry Vyukov <dvyukov@google.com>


> ---
>  net/core/dev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 8221322d86db..56c8b0921c9f 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -10284,7 +10284,7 @@ static struct net_device *netdev_wait_allrefs_any(struct list_head *list)
>                                 return dev;
>
>                 if (time_after(jiffies, warning_time +
> -                              netdev_unregister_timeout_secs * HZ)) {
> +                              READ_ONCE(netdev_unregister_timeout_secs) * HZ)) {
>                         list_for_each_entry(dev, list, todo_list) {
>                                 pr_emerg("unregister_netdevice: waiting for %s to become free. Usage count = %d\n",
>                                          dev->name, netdev_refcnt_read(dev));
> --
> 2.30.2
>

  reply	other threads:[~2022-08-18  6:53 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-18  3:52 [PATCH v2 net 00/17] net: sysctl: Fix data-races around net.core.XXX Kuniyuki Iwashima
2022-08-18  3:52 ` [PATCH v2 net 01/17] net: Fix data-races around sysctl_[rw]mem_(max|default) Kuniyuki Iwashima
2022-08-18  3:52 ` [PATCH v2 net 02/17] net: Fix data-races around weight_p and dev_weight_[rt]x_bias Kuniyuki Iwashima
2022-08-18  3:52 ` [PATCH v2 net 03/17] net: Fix data-races around netdev_max_backlog Kuniyuki Iwashima
2022-08-18  3:52 ` [PATCH v2 net 04/17] net: Fix data-races around netdev_tstamp_prequeue Kuniyuki Iwashima
2022-08-18  3:52 ` [PATCH v2 net 05/17] ratelimit: Fix data-races in ___ratelimit() Kuniyuki Iwashima
2022-08-18  3:52 ` [PATCH v2 net 06/17] net: Fix data-races around sysctl_optmem_max Kuniyuki Iwashima
2022-08-18  3:52 ` [PATCH v2 net 07/17] net: Fix a data-race around sysctl_tstamp_allow_data Kuniyuki Iwashima
2022-08-18  3:52 ` [PATCH v2 net 08/17] net: Fix a data-race around sysctl_net_busy_poll Kuniyuki Iwashima
2022-08-18  3:52 ` [PATCH v2 net 09/17] net: Fix a data-race around sysctl_net_busy_read Kuniyuki Iwashima
2022-08-18  3:52 ` [PATCH v2 net 10/17] net: Fix a data-race around netdev_budget Kuniyuki Iwashima
2022-08-18  3:52 ` [PATCH v2 net 11/17] net: Fix data-races around sysctl_max_skb_frags Kuniyuki Iwashima
2022-08-18  3:52 ` [PATCH v2 net 12/17] net: Fix a data-race around netdev_budget_usecs Kuniyuki Iwashima
2022-08-18  3:52 ` [PATCH v2 net 13/17] net: Fix data-races around sysctl_fb_tunnels_only_for_init_net Kuniyuki Iwashima
2022-08-18  7:58   ` kernel test robot
2022-08-18  8:51   ` kernel test robot
2022-08-18 15:01     ` Kuniyuki Iwashima
2022-08-18 15:01       ` Kuniyuki Iwashima
2022-08-18 16:23       ` Nathan Chancellor
2022-08-18 16:23         ` Nathan Chancellor
2022-08-18 16:41         ` Kuniyuki Iwashima
2022-08-18 16:41           ` Kuniyuki Iwashima
2022-08-18 16:17   ` Kuniyuki Iwashima
2022-08-18  3:52 ` [PATCH v2 net 14/17] net: Fix data-races around sysctl_devconf_inherit_init_net Kuniyuki Iwashima
2022-08-18  3:52 ` [PATCH v2 net 15/17] net: Fix a data-race around gro_normal_batch Kuniyuki Iwashima
2022-08-18 13:22   ` Edward Cree
2022-08-18  3:52 ` [PATCH v2 net 16/17] net: Fix a data-race around netdev_unregister_timeout_secs Kuniyuki Iwashima
2022-08-18  6:53   ` Dmitry Vyukov [this message]
2022-08-18  3:52 ` [PATCH v2 net 17/17] net: Fix a data-race around sysctl_somaxconn Kuniyuki Iwashima

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACT4Y+YJZyfrea7VxHt3varEE0jqJn-d9jaNeE-NXSAXOfi8Ew@mail.gmail.com \
    --to=dvyukov@google.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=elver@google.com \
    --cc=kuba@kernel.org \
    --cc=kuni1840@gmail.com \
    --cc=kuniyu@amazon.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.