Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Feb 2016 07:54:57 +0100
From:      Hans Petter Selasky <hps@selasky.org>
To:        Greg Quinlan <gwq_uk@yahoo.com>, "freebsd-current@freebsd.org" <freebsd-current@freebsd.org>
Subject:   Re: Open Sound System - OSS "soundon" command causes KERNEL PANIC FreeBSD-11
Message-ID:  <56BC3041.7050203@selasky.org>
In-Reply-To: <872763758.2494245.1455156152295.JavaMail.yahoo@mail.yahoo.com>
References:  <56BB0BDB.2090203@selasky.org> <872763758.2494245.1455156152295.JavaMail.yahoo@mail.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------080300080004060901070002
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit

On 02/11/16 03:02, Greg Quinlan wrote:
> Hi HPS,
> Note: Does not happen on FreeBSD 10.1-Stable!
>

Yes, that's because WITNESS is off in 10.x by default.

Does the attached patch solve your problem?

--HPS


--------------080300080004060901070002
Content-Type: text/x-diff;
 name="kern_module.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="kern_module.diff"

Index: sys/kern/kern_module.c
===================================================================
--- sys/kern/kern_module.c	(revision 295464)
+++ sys/kern/kern_module.c	(working copy)
@@ -214,16 +214,24 @@
 module_lookupbyname(const char *name)
 {
 	module_t mod;
+	int xlocked;
 	int err;
 
-	MOD_LOCK_ASSERT;
-
+	/*
+	 * If the context is not properly locked, apply the proper
+	 * locks here:
+	 */
+	xlocked = sx_xlocked(&modules_sx);
+	if (!xlocked)
+		MOD_SLOCK;
 	TAILQ_FOREACH(mod, &modules, link) {
 		err = strcmp(mod->name, name);
 		if (err == 0)
-			return (mod);
+			break;
 	}
-	return (NULL);
+	if (!xlocked)
+		MOD_SUNLOCK;
+	return (mod);
 }
 
 module_t

--------------080300080004060901070002--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?56BC3041.7050203>