Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Add the lock to refer the list included in ethercom for ...
details: https://anonhg.NetBSD.org/src/rev/9848302a30d3
branches: trunk
changeset: 319857:9848302a30d3
user: yamaguchi <yamaguchi%NetBSD.org@localhost>
date: Thu Jun 14 08:06:07 2018 +0000
description:
Add the lock to refer the list included in ethercom for safety
The lock is already held while adding and deleting
ok ozaki-r@
diffstat:
sys/net/if_vlan.c | 11 +++++++++--
sys/netinet/ip_carp.c | 11 +++++++++--
2 files changed, 18 insertions(+), 4 deletions(-)
diffs (82 lines):
diff -r 5388f708a1cb -r 9848302a30d3 sys/net/if_vlan.c
--- a/sys/net/if_vlan.c Thu Jun 14 08:00:24 2018 +0000
+++ b/sys/net/if_vlan.c Thu Jun 14 08:06:07 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_vlan.c,v 1.127 2018/06/14 07:54:57 yamaguchi Exp $ */
+/* $NetBSD: if_vlan.c,v 1.128 2018/06/14 08:06:07 yamaguchi 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.127 2018/06/14 07:54:57 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.128 2018/06/14 08:06:07 yamaguchi Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -1176,7 +1176,11 @@
*/
error = ether_multiaddr(sa, addrlo, addrhi);
KASSERT(error == 0);
+
+ ETHER_LOCK(&ifv->ifv_ec);
mc->mc_enm = ether_lookup_multi(addrlo, addrhi, &ifv->ifv_ec);
+ ETHER_UNLOCK(&ifv->ifv_ec);
+
KASSERT(mc->mc_enm != NULL);
memcpy(&mc->mc_addr, sa, sa->sa_len);
@@ -1221,7 +1225,10 @@
*/
if ((error = ether_multiaddr(sa, addrlo, addrhi)) != 0)
return error;
+
+ ETHER_LOCK(&ifv->ifv_ec);
enm = ether_lookup_multi(addrlo, addrhi, &ifv->ifv_ec);
+ ETHER_UNLOCK(&ifv->ifv_ec);
error = ether_delmulti(sa, &ifv->ifv_ec);
if (error != ENETRESET)
diff -r 5388f708a1cb -r 9848302a30d3 sys/netinet/ip_carp.c
--- a/sys/netinet/ip_carp.c Thu Jun 14 08:00:24 2018 +0000
+++ b/sys/netinet/ip_carp.c Thu Jun 14 08:06:07 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_carp.c,v 1.97 2018/06/14 07:54:57 yamaguchi Exp $ */
+/* $NetBSD: ip_carp.c,v 1.98 2018/06/14 08:06:07 yamaguchi Exp $ */
/* $OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $ */
/*
@@ -33,7 +33,7 @@
#endif
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.97 2018/06/14 07:54:57 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.98 2018/06/14 08:06:07 yamaguchi Exp $");
/*
* TODO:
@@ -2312,7 +2312,11 @@
* statement shouldn't fail.
*/
(void)ether_multiaddr(sa, addrlo, addrhi);
+
+ ETHER_LOCK(&sc->sc_ac);
mc->mc_enm = ether_lookup_multi(addrlo, addrhi, &sc->sc_ac);
+ ETHER_UNLOCK(&sc->sc_ac);
+
memcpy(&mc->mc_addr, sa, sa->sa_len);
LIST_INSERT_HEAD(&sc->carp_mc_listhead, mc, mc_entries);
@@ -2351,7 +2355,10 @@
*/
if ((error = ether_multiaddr(sa, addrlo, addrhi)) != 0)
return (error);
+
+ ETHER_LOCK(&sc->sc_ac);
enm = ether_lookup_multi(addrlo, addrhi, &sc->sc_ac);
+ ETHER_UNLOCK(&sc->sc_ac);
if (enm == NULL)
return (EINVAL);
Home |
Main Index |
Thread Index |
Old Index