From 25658c4f5f6bde3c3ba1b7addd39f515598bdf30 Mon Sep 17 00:00:00 2001 From: Abel Mathew Date: Thu, 17 Jan 2013 21:59:32 +0000 Subject: [PATCH] ck_queue: Fix CK_LIST_INSERT_HEAD. CK_LIST_INSERT_HEAD was incorrectly managing prev pointer on insertion to non-empty list. This bug would cause erroneous behavior on CK_LIST_REMOVE to non-head elements. Unit test will be updated for this regression. --- include/ck_queue.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ck_queue.h b/include/ck_queue.h index bfd7c0b..a9a502d 100644 --- a/include/ck_queue.h +++ b/include/ck_queue.h @@ -258,9 +258,9 @@ struct { \ #define CK_LIST_INSERT_HEAD(head, elm, field) do { \ (elm)->field.le_next = (head)->lh_first; \ ck_pr_fence_store(); \ - ck_pr_store_ptr(&(head)->lh_first, elm); \ if ((elm)->field.le_next != NULL) \ (head)->lh_first->field.le_prev = &(elm)->field.le_next; \ + ck_pr_store_ptr(&(head)->lh_first, elm); \ (elm)->field.le_prev = &(head)->lh_first; \ } while (0)