diff options
author | mjg <mjg@FreeBSD.org> | 2012-06-11 17:42:39 +0000 |
---|---|---|
committer | mjg <mjg@FreeBSD.org> | 2012-06-11 17:42:39 +0000 |
commit | fa660450ebb8fe4c0c463ded43950c1616aac00e (patch) | |
tree | 1c171c4f144ce631840df8690c6dc5050633cedb /sys/libkern | |
parent | 307fcde10052c1c0d84e3cc7378c0d1642742d2a (diff) | |
download | FreeBSD-src-fa660450ebb8fe4c0c463ded43950c1616aac00e.zip FreeBSD-src-fa660450ebb8fe4c0c463ded43950c1616aac00e.tar.gz |
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
Diffstat (limited to 'sys/libkern')
-rw-r--r-- | sys/libkern/iconv.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/libkern/iconv.c b/sys/libkern/iconv.c index ed928f0..dcdb119 100644 --- a/sys/libkern/iconv.c +++ b/sys/libkern/iconv.c @@ -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) |