Add the lock to refer the list included in ethercom for safety
The lock is already held while adding and deleting ok ozaki-r@
This commit is contained in:
parent
e6eb667a4d
commit
ebf325ec6a
|
@ -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 @@ vlan_ether_addmulti(struct ifvlan *ifv, struct ifreq *ifr)
|
|||
*/
|
||||
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 @@ vlan_ether_delmulti(struct ifvlan *ifv, struct ifreq *ifr)
|
|||
*/
|
||||
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)
|
||||
|
|
|
@ -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 @@ carp_ether_addmulti(struct carp_softc *sc, struct ifreq *ifr)
|
|||
* 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 @@ carp_ether_delmulti(struct carp_softc *sc, struct ifreq *ifr)
|
|||
*/
|
||||
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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue