Module Name: src
Committed By: christos
Date: Mon Mar 30 11:57:50 UTC 2020
Modified Files:
src/sys/net: if_gif.c
Log Message:
On detach, destroy the mutex attach created, otherwise we crash with LOCKDEBUG.
XXX: other interface drivers have this issue.
To generate a diff of this commit:
cvs rdiff -u -r1.152 -r1.153 src/sys/net/if_gif.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/net/if_gif.c
diff -u src/sys/net/if_gif.c:1.152 src/sys/net/if_gif.c:1.153
--- src/sys/net/if_gif.c:1.152 Fri Jan 31 21:57:45 2020
+++ src/sys/net/if_gif.c Mon Mar 30 07:57:50 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_gif.c,v 1.152 2020/02/01 02:57:45 riastradh Exp $ */
+/* $NetBSD: if_gif.c,v 1.153 2020/03/30 11:57:50 christos Exp $ */
/* $KAME: if_gif.c,v 1.76 2001/08/20 02:01:02 kjc Exp $ */
/*
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.152 2020/02/01 02:57:45 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.153 2020/03/30 11:57:50 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -324,22 +324,20 @@ gifinit(void)
static int
gifdetach(void)
{
- int error = 0;
mutex_enter(&gif_softcs.lock);
if (!LIST_EMPTY(&gif_softcs.list)) {
mutex_exit(&gif_softcs.lock);
- error = EBUSY;
+ return EBUSY;
}
- if (error == 0) {
- psref_class_destroy(gv_psref_class);
-
- if_clone_detach(&gif_cloner);
- sysctl_teardown(&gif_sysctl);
- }
+ psref_class_destroy(gv_psref_class);
- return error;
+ if_clone_detach(&gif_cloner);
+ sysctl_teardown(&gif_sysctl);
+ mutex_exit(&gif_softcs.lock);
+ mutex_destroy(&gif_softcs.lock);
+ return 0;
}
static int