summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-01-04 09:55:59 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-01-05 07:09:56 +0100
commit9c615b7835f397698e0b8c41fa598180cee8ce7a (patch)
tree4c545cffd63240ced5eb040c048c3caadac2ecf6 /cpukit
parentLICENSE.WEBSERVER: GoAhead server removed before 4.11 branched. Obsolete. (diff)
downloadrtems-9c615b7835f397698e0b8c41fa598180cee8ce7a.tar.bz2
score: Fix watchdog insert
Under certain conditions a new watchdog was inserted with a wrong and very large delta interval due to a wrong iterator update. Bug was introduced by 1ccbd052910ed16131c74b0d5595c8a94066942d. Close #2507.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/score/src/watchdoginsert.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/cpukit/score/src/watchdoginsert.c b/cpukit/score/src/watchdoginsert.c
index 6b81c7b872..db15f55b0d 100644
--- a/cpukit/score/src/watchdoginsert.c
+++ b/cpukit/score/src/watchdoginsert.c
@@ -22,14 +22,16 @@
static void _Watchdog_Insert_fixup(
Watchdog_Header *header,
+ Watchdog_Control *the_watchdog,
+ Watchdog_Interval delta,
Watchdog_Control *next_watchdog,
- Watchdog_Interval delta
+ Watchdog_Interval delta_next
)
{
const Chain_Node *iterator_tail;
Chain_Node *iterator_node;
- next_watchdog->delta_interval -= delta;
+ next_watchdog->delta_interval = delta_next - delta;
iterator_node = _Chain_First( &header->Iterators );
iterator_tail = _Chain_Immutable_tail( &header->Iterators );
@@ -40,7 +42,7 @@ static void _Watchdog_Insert_fixup(
iterator = (Watchdog_Iterator *) iterator_node;
if ( iterator->current == &next_watchdog->Node ) {
- iterator->delta_interval -= delta;
+ iterator->current = &the_watchdog->Node;
}
iterator_node = _Chain_Next( iterator_node );
@@ -76,7 +78,13 @@ void _Watchdog_Insert_locked(
delta_next = next_watchdog->delta_interval;
if ( delta < delta_next ) {
- _Watchdog_Insert_fixup( header, next_watchdog, delta );
+ _Watchdog_Insert_fixup(
+ header,
+ the_watchdog,
+ delta,
+ next_watchdog,
+ delta_next
+ );
break;
}