Skip to content

Commit 9121eb4

Browse files
committed
opal/lifo: fix a ABA problem in opal_lifo_pop_atomic
that was introduced in 11bb8b0 Fixes #4784 Signed-off-by: Gilles Gouaillardet <[email protected]>
1 parent efd715e commit 9121eb4

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

opal/class/opal_lifo.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
* Copyright (c) 2010 IBM Corporation. All rights reserved.
1515
* Copyright (c) 2014-2017 Los Alamos National Security, LLC. All rights
1616
* reseved.
17-
* Copyright (c) 2016 Research Organization for Information Science
18-
* and Technology (RIST). All rights reserved.
17+
* Copyright (c) 2016-2018 Research Organization for Information Science
18+
* and Technology (RIST). All rights reserved.
1919
* $COPYRIGHT$
2020
*
2121
* Additional copyrights may follow
@@ -240,9 +240,7 @@ static inline opal_list_item_t *opal_lifo_pop_atomic (opal_lifo_t* lifo)
240240
{
241241
opal_list_item_t *item, *head, *ghost = &lifo->opal_lifo_ghost;
242242

243-
item = (opal_list_item_t *) lifo->opal_lifo_head.data.item;
244-
245-
while (item != ghost) {
243+
while ((item=(opal_list_item_t *)lifo->opal_lifo_head.data.item) != ghost) {
246244
/* ensure it is safe to pop the head */
247245
if (opal_atomic_swap_32((volatile int32_t *) &item->item_free, 1)) {
248246
continue;

0 commit comments

Comments
 (0)