Changeset 30f1a25 in mainline for kernel/generic/src/ddi/irq.c


Ignore:
Timestamp:
2018-03-14T18:54:08Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
67f11a0
Parents:
963037b0
Message:

Make hash_table_find_next immune to livelocks

By giving hash_table_find_next the item returned from hash_table_find,
we provide it with a fixed reference with which the outer loop which
calls hash_table_find_next can terminate even if the respective bucket
contains more matching elements.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/ddi/irq.c

    r963037b0 r30f1a25  
    141141{
    142142        irq_spinlock_lock(l, false);
    143         for (ht_link_t *lnk = hash_table_find(h, &inr); lnk;
    144             lnk = hash_table_find_next(h, lnk)) {
     143        ht_link_t *first = hash_table_find(h, &inr);
     144        for (ht_link_t *lnk = first; lnk;
     145            lnk = hash_table_find_next(h, first, lnk)) {
    145146                irq_t *irq = hash_table_get_inst(lnk, irq_t, link);
    146147                irq_spinlock_lock(&irq->lock, false);
Note: See TracChangeset for help on using the changeset viewer.