Source-Changes-HG archive

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

[src/trunk]: src/sys/net Add missing IFNET_LOCK() and IFNET_UNLOCK() in vlan_...



details:   https://anonhg.NetBSD.org/src/rev/f1069e92d08d
branches:  trunk
changeset: 964854:f1069e92d08d
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Tue Aug 20 03:56:59 2019 +0000

description:
Add missing IFNET_LOCK() and IFNET_UNLOCK() in vlan_config().

XXX pullup-9

diffstat:

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

diffs (44 lines):

diff -r 7bff75f40f93 -r f1069e92d08d sys/net/if_vlan.c
--- a/sys/net/if_vlan.c Tue Aug 20 03:50:55 2019 +0000
+++ b/sys/net/if_vlan.c Tue Aug 20 03:56:59 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_vlan.c,v 1.142 2019/08/20 03:50:55 msaitoh Exp $    */
+/*     $NetBSD: if_vlan.c,v 1.143 2019/08/20 03:56:59 msaitoh 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.142 2019/08/20 03:50:55 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.143 2019/08/20 03:56:59 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -494,8 +494,11 @@
                            KM_SLEEP);
                        if (vidmem == NULL){
                                ec->ec_nvlans--;
-                               if (ec->ec_nvlans == 0)
+                               if (ec->ec_nvlans == 0) {
+                                       IFNET_LOCK(p);
                                        (void)ether_disable_vlan_mtu(p);
+                                       IFNET_UNLOCK(p);
+                               }
                                error = ENOMEM;
                                goto done;
                        }
@@ -509,8 +512,11 @@
                                error = (*ec->ec_vlan_cb)(ec, vid, true);
                                if (error) {
                                        ec->ec_nvlans--;
-                                       if (ec->ec_nvlans == 0)
+                                       if (ec->ec_nvlans == 0) {
+                                               IFNET_LOCK(p);
                                                (void)ether_disable_vlan_mtu(p);
+                                               IFNET_UNLOCK(p);
+                                       }
                                        goto done;
                                }
                        }



Home | Main Index | Thread Index | Old Index