aboutsummaryrefslogtreecommitdiff
path: root/lib/timerqueue.c
diff options
context:
space:
mode:
authorSiqi Lin <siqilin@google.com>2017-05-23 14:39:05 -0700
committerSiqi Lin <siqilin@google.com>2017-05-23 17:15:33 -0700
commit814a3a1df3e6a11a7846ec5febe96ac4e9353ee9 (patch)
tree50808608b98f7b57e7bcacbd231d58b8dad913c4 /lib/timerqueue.c
parent43feadd5f1036ec79887ba29519de032c0fd3322 (diff)
rbtree: Detect left/right pointer assignments that would cause loops
Add checks before all left/right pointer assignments to verify that the pointer value being assigned isn't the same node as the left/right pointer. This is a BUG_ON() because we want to get a crash dump as close to the source of the corruption as possible. Once the red-black tree is corrupted, the kernel will eventually crash anyway and by then the root cause will be gone. Bug: 38121882 Change-Id: Ifa59c08d5bd2218e667e4c08162fffbaf388628a Signed-off-by: Siqi Lin <siqilin@google.com>
Diffstat (limited to 'lib/timerqueue.c')
-rw-r--r--lib/timerqueue.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/timerqueue.c b/lib/timerqueue.c
index a382e4a3260..c6679a9338c 100644
--- a/lib/timerqueue.c
+++ b/lib/timerqueue.c
@@ -43,7 +43,7 @@ void timerqueue_add(struct timerqueue_head *head, struct timerqueue_node *node)
struct timerqueue_node *ptr;
/* Make sure we don't add nodes that are already added */
- WARN_ON_ONCE(!RB_EMPTY_NODE(&node->node));
+ BUG_ON(!RB_EMPTY_NODE(&node->node));
while (*p) {
parent = *p;
@@ -71,7 +71,7 @@ EXPORT_SYMBOL_GPL(timerqueue_add);
*/
void timerqueue_del(struct timerqueue_head *head, struct timerqueue_node *node)
{
- WARN_ON_ONCE(RB_EMPTY_NODE(&node->node));
+ BUG_ON(RB_EMPTY_NODE(&node->node));
/* update next pointer */
if (head->next == node) {