Subject: Re: kern/36673 (dubious code is sysmon_envsys)
To: None <xtraeme@NetBSD.org, gnats-admin@netbsd.org,>
From: Juan RP <juan@xtrarom.org>
List: netbsd-bugs
Date: 07/23/2007 23:55:02
The following reply was made to PR kern/36673; it has been noted by GNATS.
From: Juan RP <juan@xtrarom.org>
To: gnats-bugs@NetBSD.org
Cc: yamt@mwd.biglobe.ne.jp
Subject: Re: kern/36673 (dubious code is sysmon_envsys)
Date: Tue, 24 Jul 2007 01:53:25 +0200
On Mon, 23 Jul 2007 23:40:03 +0000 (UTC)
Juan RP <juan@xtrarom.org> wrote:
> Do you think the following patch is ok for you?
Erm... please ignore previous patch, what about this one?
Index: sysmon_envsys.c
===================================================================
RCS file: /cvsroot/src/sys/dev/sysmon/sysmon_envsys.c,v
retrieving revision 1.43
diff -b -u -r1.43 sysmon_envsys.c
--- sysmon_envsys.c 23 Jul 2007 17:51:16 -0000 1.43
+++ sysmon_envsys.c 23 Jul 2007 23:51:47 -0000
@@ -483,7 +483,6 @@
mutex_enter(&sme_list_mtx);
LIST_FOREACH(lsme, &sysmon_envsys_list, sme_list) {
if (strcmp(lsme->sme_name, sme->sme_name) == 0) {
- mutex_exit(&sme_list_mtx);
error = EEXIST;
goto out;
}
@@ -496,16 +495,14 @@
sme->sme_fsensor = sysmon_envsys_next_sensor_index;
sysmon_envsys_next_sensor_index += sme->sme_nsensors;
#endif
- mutex_exit(&sme_list_mtx);
error = sysmon_envsys_createplist(sme);
if (!error) {
- mutex_enter(&sme_list_mtx);
LIST_INSERT_HEAD(&sysmon_envsys_list, sme, sme_list);
sme_uniqsensors = 0;
- mutex_exit(&sme_list_mtx);
}
out:
+ mutex_exit(&sme_list_mtx);
return error;
}
@@ -626,6 +623,9 @@
nsens = error = 0;
+ KASSERT(mutex_owned(&sme_list_mtx));
+ mutex_exit(&sme_list_mtx);
+
/* create the sysmon envsys device array. */
array = prop_array_create();
if (array == NULL)
@@ -688,6 +688,7 @@
prop_object_release(array);
+ mutex_enter(&sme_list_mtx);
return error;
}
--
Juan Romero Pardines - The NetBSD Project
http://plog.xtrarom.org - NetBSD/pkgsrc news in Spanish