svn commit: r245149 - stable/9/sys/libkern

Kevin Lo kevlo at FreeBSD.org
Tue Jan 8 04:43:20 UTC 2013


Author: kevlo
Date: Tue Jan  8 04:43:20 2013
New Revision: 245149
URL: http://svnweb.freebsd.org/changeset/base/245149

Log:
  MFC r236899:
  
  Fix unloading of libiconv module.
  
  Previously it would either loop infinitely or exit with error leaking a lock.

Modified:
  stable/9/sys/libkern/iconv.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/libkern/iconv.c
==============================================================================
--- stable/9/sys/libkern/iconv.c	Tue Jan  8 03:27:37 2013	(r245148)
+++ stable/9/sys/libkern/iconv.c	Tue Jan  8 04:43:20 2013	(r245149)
@@ -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-stable-9 mailing list