<div class="gmail_quote">On Wed, Apr 21, 2010 at 1:50 AM, Justin Pettit <span dir="ltr">&lt;<a href="mailto:jpettit@nicira.com">jpettit@nicira.com</a>&gt;</span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

 static __exit void veth_exit(void)<br>
 {<br>
+       struct veth_priv *p, *n;<br>
+<br>
+       rtnl_lock();<br>
+       list_for_each_entry_safe(p, n, &amp;veth_list, list) {<br>
+               veth_dellink(p-&gt;dev);<br>
+       }<br></blockquote><div><br></div><div>I don&#39;t think this is safe.  With the *_safe variants of functions it is OK to remove the current element but not necessarily arbitrary elements since they store the next list entry in n before returning p so you can delete p.  However, veth_dellink deletes both the link and its peer (which is probably the next entry).</div>
<div><br></div><div>Also, kernel style is to drop the braces.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
+       rtnl_unlock();<br>
+<br>
        unregister_netdevice_notifier(&amp;veth_notifier_block);<br>
+       veth_destroy_sysfs();<br>
 }<br>
<br>
 module_init(veth_init);<br></blockquote><div><br></div><div>Otherwise good catches. </div></div>