diff options
author | Wei Wang <weiwan@google.com> | 2017-10-06 12:06:08 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-10-07 21:22:58 +0100 |
commit | 8d1040e808bb2a5aeb4f0791b32bc7356a01ab11 (patch) | |
tree | f4bf4d0471b7d5c75c21f5990fecac90fdb1f57d /fs | |
parent | bbd63f06d114a52be33f6982fc89ca2768cdeb62 (diff) | |
download | lwn-8d1040e808bb2a5aeb4f0791b32bc7356a01ab11.tar.gz lwn-8d1040e808bb2a5aeb4f0791b32bc7356a01ab11.zip |
ipv6: check fn->leaf before it is used
If rwlock is replaced with rcu and spinlock, it is possible that the
reader thread will see fn->leaf as NULL in the following scenarios:
1. fib6_add() is in progress and we have already inserted a new node but
not yet inserted the route.
2. fib6_del_route() is in progress and we have already set fn->leaf to
NULL but not yet freed the node because of rcu grace period.
This patch makes sure all the reader threads check fn->leaf first before
using it. And together with later patch to grab rcu_read_lock() and
rcu_dereference() fn->leaf, it makes sure reader threads are safe when
accessing fn->leaf.
Signed-off-by: Wei Wang <weiwan@google.com>
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'fs')
0 files changed, 0 insertions, 0 deletions