From: David Miller <davem@davemloft.net>
To: cai@lca.pw
Cc: kuznet@ms2.inr.ac.ru, yoshfuji@linux-ipv6.org, kuba@kernel.org,
eric.dumazet@gmail.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] ipv4: fix a RCU-list lock in fib_triestat_seq_show
Date: Sun, 29 Mar 2020 21:52:23 -0700 (PDT) [thread overview]
Message-ID: <20200329.215223.1631308723332593306.davem@davemloft.net> (raw)
In-Reply-To: <20200325220100.7863-1-cai@lca.pw>
From: Qian Cai <cai@lca.pw>
Date: Wed, 25 Mar 2020 18:01:00 -0400
> fib_triestat_seq_show() calls hlist_for_each_entry_rcu(tb, head,
> tb_hlist) without rcu_read_lock() will trigger a warning,
>
> net/ipv4/fib_trie.c:2579 RCU-list traversed in non-reader section!!
>
> other info that might help us debug this:
>
> rcu_scheduler_active = 2, debug_locks = 1
> 1 lock held by proc01/115277:
> #0: c0000014507acf00 (&p->lock){+.+.}-{3:3}, at: seq_read+0x58/0x670
>
> Call Trace:
> dump_stack+0xf4/0x164 (unreliable)
> lockdep_rcu_suspicious+0x140/0x164
> fib_triestat_seq_show+0x750/0x880
> seq_read+0x1a0/0x670
> proc_reg_read+0x10c/0x1b0
> __vfs_read+0x3c/0x70
> vfs_read+0xac/0x170
> ksys_read+0x7c/0x140
> system_call+0x5c/0x68
>
> Fix it by adding a pair of rcu_read_lock/unlock() and use
> cond_resched_rcu() to avoid the situation where walking of a large
> number of items may prevent scheduling for a long time.
>
> Signed-off-by: Qian Cai <cai@lca.pw>
Applied and queued up for -stable, thanks.
prev parent reply other threads:[~2020-03-30 4:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-25 22:01 [PATCH v2] ipv4: fix a RCU-list lock in fib_triestat_seq_show Qian Cai
2020-03-27 3:27 ` David Miller
2020-03-27 5:41 ` Eric Dumazet
2020-03-30 4:52 ` David Miller [this message]
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=20200329.215223.1631308723332593306.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=cai@lca.pw \
--cc=eric.dumazet@gmail.com \
--cc=kuba@kernel.org \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=yoshfuji@linux-ipv6.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).