Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net vlan: call ether_ifdetach without IFNET_LOCK



details:   https://anonhg.NetBSD.org/src/rev/01b9849d6edc
branches:  trunk
changeset: 833119:01b9849d6edc
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Tue Jun 12 04:20:36 2018 +0000

description:
vlan: call ether_ifdetach without IFNET_LOCK

Fix PR kern/53357

diffstat:

 sys/net/if_vlan.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (32 lines):

diff -r d3c617561fcb -r 01b9849d6edc sys/net/if_vlan.c
--- a/sys/net/if_vlan.c Tue Jun 12 00:42:17 2018 +0000
+++ b/sys/net/if_vlan.c Tue Jun 12 04:20:36 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_vlan.c,v 1.125 2018/03/16 17:00:35 tih Exp $        */
+/*     $NetBSD: if_vlan.c,v 1.126 2018/06/12 04:20:36 ozaki-r Exp $    */
 
 /*
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.125 2018/03/16 17:00:35 tih Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.126 2018/06/12 04:20:36 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -625,7 +625,13 @@
                        IFNET_UNLOCK(p);
                }
 
+               /* XXX ether_ifdetach must not be called with IFNET_LOCK */
+               mutex_exit(&ifv->ifv_lock);
+               IFNET_UNLOCK(ifp);
                ether_ifdetach(ifp);
+               IFNET_LOCK(ifp);
+               mutex_enter(&ifv->ifv_lock);
+
                /* Restore vlan_ioctl overwritten by ether_ifdetach */
                ifp->if_ioctl = vlan_ioctl;
                vlan_reset_linkname(ifp);



Home | Main Index | Thread Index | Old Index