Module Name: src Committed By: christos Date: Wed Jan 25 03:04:22 UTC 2017
Modified Files: src/sys/net: if.c Log Message: fix locking against myself in module autoload; module autoload calls if_clone_attach which takes the lock again. To generate a diff of this commit: cvs rdiff -u -r1.374 -r1.375 src/sys/net/if.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.c diff -u src/sys/net/if.c:1.374 src/sys/net/if.c:1.375 --- src/sys/net/if.c:1.374 Tue Jan 24 02:58:58 2017 +++ src/sys/net/if.c Tue Jan 24 22:04:21 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: if.c,v 1.374 2017/01/24 07:58:58 ozaki-r Exp $ */ +/* $NetBSD: if.c,v 1.375 2017/01/25 03:04:21 christos Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc. @@ -90,7 +90,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.374 2017/01/24 07:58:58 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.375 2017/01/25 03:04:21 christos Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -1619,8 +1619,13 @@ again: } if (ifc == NULL) { - if (*ifname == '\0' || - module_autoload(ifname, MODULE_CLASS_DRIVER)) + int error; + if (*ifname == '\0') + return NULL; + mutex_exit(&if_clone_mtx); + error = module_autoload(ifname, MODULE_CLASS_DRIVER); + mutex_enter(&if_clone_mtx); + if (error) return NULL; *ifname = '\0'; goto again;