<div dir="ltr">Still working on this. Here is some dmesg spew:<div><br></div><div><div>[  514.245846] foobar: module verification failed: signature and/or required key missing - tainting kernel</div><div>[  514.245937] kobject: &#39;foobar&#39; (f7f060c8): kobject_add_internal: parent: &#39;module&#39;, set: &#39;module&#39;</div>
<div>[  514.245951] kobject: &#39;holders&#39; (f5ff3d40): kobject_add_internal: parent: &#39;foobar&#39;, set: &#39;&lt;NULL&gt;&#39;</div><div>[  514.245981] kobject: &#39;notes&#39; (f2d25f80): kobject_add_internal: parent: &#39;foobar&#39;, set: &#39;&lt;NULL&gt;&#39;</div>
<div>[  514.245987] kobject: &#39;foobar&#39; (f7f060c8): kobject_uevent_env</div><div>[  514.245998] kobject: &#39;foobar&#39; (f7f060c8): fill_kobj_path: path = &#39;/module/foobar&#39;</div></div><div><br></div><div>So it looks like kernel validation is failing. I have printk&#39;s in my init fxn that are never turning up in /var/log/messages, until, weirdly, AFTER I remove the device:</div>
<div><br></div><div>&lt;insmod device&gt;</div><div><div>Dec 30 09:43:03 localhost kernel: [  514.245846] foobar: module verification failed: signature and/or required key missing - tainting kernel</div><div>Dec 30 09:43:16 localhost fprintd[1085]: ** Message: No devices in use, exit</div>
</div><div><br></div><div>&lt;rmmod device&gt;</div><div><div>Dec 30 09:45:53 localhost kernel: [  514.249323] foobar: got device number 248, minor is 0   &lt;&lt;&lt;&lt;----THIS IS IN init() fxn</div><div>Dec 30 09:45:53 localhost kernel: [  684.102912] unregister_chrdev(248) called for foobar&lt;7&gt;[  684.102927] kobject: &#39;(null)&#39; (f7f06220): kobject_cleanup, parent   (null)</div>
</div><div><br></div><div>&lt;insmod&gt;</div><div>insmod: ERROR: could not insert module ./foobar.ko: Device or resource busy<br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Dec 27, 2013 at 9:13 PM,  <span dir="ltr">&lt;<a href="mailto:Valdis.Kletnieks@vt.edu" target="_blank">Valdis.Kletnieks@vt.edu</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Fri, 27 Dec 2013 19:33:50 -0800, Eric Fowler said:<br>
<br>
&gt; I suspect I am doing something wrong in the code with<br>
&gt; register/unregister_chrdev(), but I have been over that code a million<br>
&gt; times. It looks fine.<br>
&gt;<br>
&gt; Now:<br>
&gt; insmod the device, OK<br>
&gt; rmmod the device, OK<br>
&gt; Check /proc/devices , device # is present<br>
&gt; insmod the device again, fails with ERROR: could not insert module<br>
&gt; ./foobar.ko: Device or resource busy<br>
<br>
</div>It does smell like an unregister issue.  You may want to try adding<br>
printk() calls to print out the return code from register and unregister.<br>
I&#39;m willing to bet that (a) the unegister is failing because somebody<br>
still has a reference on the device, and (b) the second register call fails<br>
because the device already exists, causing your module_init() to bail out.<br>
<br>
The fun is that you may not have taken a reference on the device directly<br>
yourself - you may have called some other get_foo() that ends up taking an<br>
implicit reference under the covers, causing issues when you fail to call<br>
put_foo() at the right place...<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">cc:NSA<br></div>
</div>