svn commit: r236899 - head/sys/libkern

Mateusz Guzik mjg at FreeBSD.org
Mon Jun 11 17:42:40 UTC 2012


Author: mjg
Date: Mon Jun 11 17:42:39 2012
New Revision: 236899
URL: http://svn.freebsd.org/changeset/base/236899

Log:
  Fix unloading of libiconv module.
  
  Previously it would either loop infinitely or exit with error leaking a lock.
  
  Reported by:	Will DeVries
  Approved by:	trasz (mentor)
  MFC after:	1 week

Modified:
  head/sys/libkern/iconv.c

Modified: head/sys/libkern/iconv.c
==============================================================================
--- head/sys/libkern/iconv.c	Mon Jun 11 17:27:53 2012	(r236898)
+++ head/sys/libkern/iconv.c	Mon Jun 11 17:42:39 2012	(r236899)
@@ -84,9 +84,11 @@ iconv_mod_unload(void)
 	struct iconv_cspair *csp;
 
 	sx_xlock(&iconv_lock);
-	while ((csp = TAILQ_FIRST(&iconv_cslist)) != NULL) {
-		if (csp->cp_refcount)
+	TAILQ_FOREACH(csp, &iconv_cslist, cp_link) {
+		if (csp->cp_refcount) {
+			sx_xunlock(&iconv_lock);
 			return EBUSY;
+		}
 	}
 
 	while ((csp = TAILQ_FIRST(&iconv_cslist)) != NULL)


More information about the svn-src-head mailing list