Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/sysmon in sysmon_envsys_unregister(): loop over sme_...



details:   https://anonhg.NetBSD.org/src/rev/55cb0e48a3bc
branches:  trunk
changeset: 840170:55cb0e48a3bc
user:      bad <bad%NetBSD.org@localhost>
date:      Tue Mar 26 15:50:23 2019 +0000

description:
in sysmon_envsys_unregister(): loop over sme_sensors_list with TAILQ_FIRST
instead of TAILQ_FOREACH.

sysmon_envsys_sensor_detach() removes the sensor from sme_sensors_list.
Hence using TAILQ_FOREACH is not safe.

Suggested by thorpej and jmcneill.  Thanks!

diffstat:

 sys/dev/sysmon/sysmon_envsys.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r d0b5b811b0cb -r 55cb0e48a3bc sys/dev/sysmon/sysmon_envsys.c
--- a/sys/dev/sysmon/sysmon_envsys.c    Tue Mar 26 15:00:34 2019 +0000
+++ b/sys/dev/sysmon/sysmon_envsys.c    Tue Mar 26 15:50:23 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysmon_envsys.c,v 1.143 2018/05/26 21:15:46 thorpej Exp $      */
+/*     $NetBSD: sysmon_envsys.c,v 1.144 2019/03/26 15:50:23 bad Exp $  */
 
 /*-
  * Copyright (c) 2007, 2008 Juan Romero Pardines.
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.143 2018/05/26 21:15:46 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.144 2019/03/26 15:50:23 bad Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -993,7 +993,7 @@
        LIST_REMOVE(sme, sme_list);
        mutex_exit(&sme_global_mtx);
 
-       TAILQ_FOREACH(edata, &sme->sme_sensors_list, sensors_head) {
+       while ((edata = TAILQ_FIRST(&sme->sme_sensors_list)) != NULL) {
                sysmon_envsys_sensor_detach(sme, edata);
        }
 



Home | Main Index | Thread Index | Old Index