diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-12-20 21:47:12 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-12-21 08:32:20 +0100 |
commit | a48b7c442db1a49acddf7a2adc07239ddb303020 (patch) | |
tree | 06eec3bf139ed9d86e5d1c67abe82196e4db0481 /cpukit/score/src/watchdogremove.c | |
parent | avr/avrtest: Remove (obselete). (diff) | |
download | rtems-a48b7c442db1a49acddf7a2adc07239ddb303020.tar.bz2 |
score: Fix watchdog removal
Under certain conditions a new watchdog was inserted with a wrong and
very large delta interval due to an incomplete iterator update.
Bug was introduced by 1ccbd052910ed16131c74b0d5595c8a94066942d.
Close #2501.
Diffstat (limited to '')
-rw-r--r-- | cpukit/score/src/watchdogremove.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/cpukit/score/src/watchdogremove.c b/cpukit/score/src/watchdogremove.c index 03c0c5f0fe..2aa72a4e75 100644 --- a/cpukit/score/src/watchdogremove.c +++ b/cpukit/score/src/watchdogremove.c @@ -61,7 +61,16 @@ static void _Watchdog_Remove_it( } if ( iterator->current == &the_watchdog->Node ) { - iterator->current = _Chain_Previous( &the_watchdog->Node ); + Chain_Node *previous = _Chain_Previous( &the_watchdog->Node ); + + iterator->current = previous; + + if ( previous != _Chain_Head( &header->Watchdogs ) ) { + Watchdog_Control *previous_watchdog; + + previous_watchdog = (Watchdog_Control *) previous; + iterator->delta_interval += previous_watchdog->delta_interval; + } } iterator_node = _Chain_Next( iterator_node ); |