[rtems-libbsd commit] Fix locking issue in epoch_watchdog()

Sebastian Huber sebh at rtems.org
Thu Nov 15 08:19:03 UTC 2018


Module:    rtems-libbsd
Branch:    master
Commit:    9f2c3ceebe191c008f004bd8dba39ebc56df51ee
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=9f2c3ceebe191c008f004bd8dba39ebc56df51ee

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Nov 15 08:23:17 2018 +0100

Fix locking issue in epoch_watchdog()

The _Watchdog_Per_CPU_insert_ticks() assumes that interrupts are
disabled.

---

 rtemsbsd/rtems/rtems-kernel-epoch.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/rtemsbsd/rtems/rtems-kernel-epoch.c b/rtemsbsd/rtems/rtems-kernel-epoch.c
index 7d42bf3..063990b 100644
--- a/rtemsbsd/rtems/rtems-kernel-epoch.c
+++ b/rtemsbsd/rtems/rtems-kernel-epoch.c
@@ -91,10 +91,13 @@ static void
 epoch_watchdog(Watchdog_Control *wdg)
 {
 	struct epoch_pcpu *epcpu;
+	ISR_Level level;
 
 	epcpu = __containerof(wdg, struct epoch_pcpu, wdg);
+	_ISR_Local_disable(level);
 	_Watchdog_Per_CPU_insert_ticks(&epcpu->wdg,
 	    _Watchdog_Get_CPU(&epcpu->wdg), 1);
+	_ISR_Local_enable(level);
 
 	if (RTEMS_PREDICT_FALSE(epcpu->cb_count != 0)) {
 		rtems_interrupt_server_request_submit(&epcpu->irq_srv_req);




More information about the vc mailing list