0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 17:51:53 +00:00

Fixed a race condition in rcu-domain blocking

This commit is contained in:
Maria Matejka 2024-06-19 12:02:34 +02:00
parent 67875e76d9
commit 9be90c0f84

View File

@ -137,6 +137,9 @@ void do_lock(struct domain_generic *dg, struct domain_generic **lsp)
void do_unlock(struct domain_generic *dg, struct domain_generic **lsp) void do_unlock(struct domain_generic *dg, struct domain_generic **lsp)
{ {
if (dg->forbidden_when_reading_rcu)
ASSERT_DIE(rcu_blocked--);
if ((char *) lsp - (char *) &locking_stack != dg->order) if ((char *) lsp - (char *) &locking_stack != dg->order)
bug("Trying to unlock on bad position: order=%u, lsp=%p, base=%p", dg->order, lsp, &locking_stack); bug("Trying to unlock on bad position: order=%u, lsp=%p, base=%p", dg->order, lsp, &locking_stack);
@ -150,6 +153,5 @@ void do_unlock(struct domain_generic *dg, struct domain_generic **lsp)
dg->prev = NULL; dg->prev = NULL;
pthread_mutex_unlock(&dg->mutex); pthread_mutex_unlock(&dg->mutex);
if (dg->forbidden_when_reading_rcu) /* From here on, the dg pointer is invalid! */
ASSERT_DIE(rcu_blocked--);
} }