Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net PR/49373: Ryota Ozaki: Running if_clone_create and i...
details: https://anonhg.NetBSD.org/src/rev/3b92a4421f3d
branches: trunk
changeset: 333532:3b92a4421f3d
user: christos <christos%NetBSD.org@localhost>
date: Fri Nov 07 12:57:42 2014 +0000
description:
PR/49373: Ryota Ozaki: Running if_clone_create and if_clone_destroy in
parallel causes panic
XXX: Pullup 7.
diffstat:
sys/net/if.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diffs (56 lines):
diff -r 82aab704d1c4 -r 3b92a4421f3d sys/net/if.c
--- a/sys/net/if.c Fri Nov 07 12:48:21 2014 +0000
+++ b/sys/net/if.c Fri Nov 07 12:57:42 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if.c,v 1.291 2014/09/09 20:16:12 rmind Exp $ */
+/* $NetBSD: if.c,v 1.292 2014/11/07 12:57:42 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.291 2014/09/09 20:16:12 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.292 2014/11/07 12:57:42 christos Exp $");
#include "opt_inet.h"
@@ -164,6 +164,7 @@
static size_t if_indexlim = 0;
static uint64_t index_gen;
static kmutex_t index_gen_mtx;
+static kmutex_t if_clone_mtx;
static struct ifaddr ** ifnet_addrs = NULL;
@@ -252,6 +253,7 @@
ifinit1(void)
{
mutex_init(&index_gen_mtx, MUTEX_DEFAULT, IPL_NONE);
+ mutex_init(&if_clone_mtx, MUTEX_DEFAULT, IPL_NONE);
TAILQ_INIT(&ifnet_list);
if_indexlim = 8;
@@ -1850,6 +1852,7 @@
struct ifreq ifrb;
struct oifreq *oifr = NULL;
#endif
+ int r;
switch (cmd) {
#ifdef COMPAT_OIFREQ
@@ -1891,9 +1894,12 @@
if (error != 0)
return error;
}
- return (cmd == SIOCIFCREATE) ?
+ mutex_enter(&if_clone_mtx);
+ r = (cmd == SIOCIFCREATE) ?
if_clone_create(ifr->ifr_name) :
if_clone_destroy(ifr->ifr_name);
+ mutex_exit(&if_clone_mtx);
+ return r;
case SIOCIFGCLONERS:
return if_clone_list((struct if_clonereq *)data);
Home |
Main Index |
Thread Index |
Old Index