diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2018-04-19 15:23:34 -0400 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2018-05-15 13:30:48 -0400 |
commit | 665f08f1ce9cf608a9435e11d66f55be4e72540a (patch) | |
tree | a5f0c6e8d759ada2ed304bca07ae3fa49bc00995 | |
parent | 360e0da67eab610b0efd53cbab3e1535095e7aa4 (diff) |
rcu: Make rcu_start_this_gp() check for out-of-range requests
If rcu_start_this_gp() is invoked with a requested grace period more
than three in the future, then either the ->need_future_gp[] array
needs to be bigger or the caller needs to be repaired. This commit
therefore adds a WARN_ON_ONCE() checking for this condition.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Tested-by: Nicholas Piggin <npiggin@gmail.com>
-rw-r--r-- | kernel/rcu/tree.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index d3c769502929..07bccb1f0c87 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c | |||
@@ -1698,6 +1698,8 @@ static bool rcu_start_this_gp(struct rcu_node *rnp, struct rcu_data *rdp, | |||
1698 | for (rnp_root = rnp; 1; rnp_root = rnp_root->parent) { | 1698 | for (rnp_root = rnp; 1; rnp_root = rnp_root->parent) { |
1699 | if (rnp_root != rnp) | 1699 | if (rnp_root != rnp) |
1700 | raw_spin_lock_rcu_node(rnp_root); | 1700 | raw_spin_lock_rcu_node(rnp_root); |
1701 | WARN_ON_ONCE(ULONG_CMP_LT(rnp_root->gpnum + | ||
1702 | need_future_gp_mask(), c)); | ||
1701 | if (need_future_gp_element(rnp_root, c) || | 1703 | if (need_future_gp_element(rnp_root, c) || |
1702 | ULONG_CMP_GE(rnp_root->gpnum, c) || | 1704 | ULONG_CMP_GE(rnp_root->gpnum, c) || |
1703 | (rnp != rnp_root && | 1705 | (rnp != rnp_root && |