Make sure *(if_output)() is called with KERNEL_LOCK held.
Add some KASSERT for this. See http://mail-index.netbsd.org/tech-net/2014/04/09/msg004511.html for details.
This commit is contained in:
parent
dca736d7bc
commit
3910868948
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ip_fil_netbsd.c,v 1.8 2014/03/16 05:20:30 dholland Exp $ */
|
||||
/* $NetBSD: ip_fil_netbsd.c,v 1.9 2014/05/13 19:36:16 bouyer Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2012 by Darren Reed.
|
||||
|
@ -8,7 +8,7 @@
|
|||
#if !defined(lint)
|
||||
#if defined(__NetBSD__)
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip_fil_netbsd.c,v 1.8 2014/03/16 05:20:30 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip_fil_netbsd.c,v 1.9 2014/05/13 19:36:16 bouyer Exp $");
|
||||
#else
|
||||
static const char sccsid[] = "@(#)ip_fil.c 2.41 6/5/96 (C) 1993-2000 Darren Reed";
|
||||
static const char rcsid[] = "@(#)Id: ip_fil_netbsd.c,v 1.1.1.2 2012/07/22 13:45:17 darrenr Exp";
|
||||
|
@ -1209,7 +1209,9 @@ ipf_fastroute(mb_t *m0, mb_t **mpp, fr_info_t *fin, frdest_t *fdp)
|
|||
ip->ip_sum = in_cksum(m, hlen);
|
||||
# endif /* M_CSUM_IPv4 */
|
||||
|
||||
KERNEL_LOCK(1, NULL);
|
||||
error = (*ifp->if_output)(ifp, m, dst, rt);
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
@ -1296,7 +1298,9 @@ sendorfree:
|
|||
m0 = m->m_act;
|
||||
m->m_act = 0;
|
||||
if (error == 0) {
|
||||
KERNEL_LOCK(1, NULL);
|
||||
error = (*ifp->if_output)(ifp, m, dst, rt);
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
} else {
|
||||
FREE_MB_T(m);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_ethersubr.c,v 1.196 2014/02/25 22:42:06 pooka Exp $ */
|
||||
/* $NetBSD: if_ethersubr.c,v 1.197 2014/05/13 19:36:16 bouyer Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
|
@ -61,7 +61,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.196 2014/02/25 22:42:06 pooka Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.197 2014/05/13 19:36:16 bouyer Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "opt_atalk.h"
|
||||
|
@ -211,6 +211,8 @@ ether_output(struct ifnet * const ifp0, struct mbuf * const m0,
|
|||
struct at_ifaddr *aa;
|
||||
#endif /* NETATALK */
|
||||
|
||||
KASSERT(KERNEL_LOCKED_P());
|
||||
|
||||
#ifdef MBUFTRACE
|
||||
m_claimm(m, ifp->if_mowner);
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_loop.c,v 1.76 2013/03/01 18:25:56 joerg Exp $ */
|
||||
/* $NetBSD: if_loop.c,v 1.77 2014/05/13 19:36:16 bouyer Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
|
@ -65,7 +65,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.76 2013/03/01 18:25:56 joerg Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.77 2014/05/13 19:36:16 bouyer Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "opt_atalk.h"
|
||||
|
@ -216,6 +216,8 @@ looutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
|
|||
int csum_flags;
|
||||
|
||||
MCLAIM(m, ifp->if_mowner);
|
||||
KASSERT(KERNEL_LOCKED_P());
|
||||
|
||||
if ((m->m_flags & M_PKTHDR) == 0)
|
||||
panic("looutput: no header mbuf");
|
||||
if (ifp->if_flags & IFF_LOOPBACK)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_vlan.c,v 1.69 2011/10/19 22:07:09 dyoung Exp $ */
|
||||
/* $NetBSD: if_vlan.c,v 1.70 2014/05/13 19:36:16 bouyer 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.69 2011/10/19 22:07:09 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.70 2014/05/13 19:36:16 bouyer Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
|
||||
|
@ -681,6 +681,8 @@ vlan_start(struct ifnet *ifp)
|
|||
int error;
|
||||
ALTQ_DECL(struct altq_pktattr pktattr;)
|
||||
|
||||
KASSERT(KERNEL_LOCKED_P());
|
||||
|
||||
ifp->if_flags |= IFF_OACTIVE;
|
||||
|
||||
for (;;) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ip_carp.c,v 1.53 2014/04/04 12:53:04 bouyer Exp $ */
|
||||
/* $NetBSD: ip_carp.c,v 1.54 2014/05/13 19:36:16 bouyer Exp $ */
|
||||
/* $OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -31,7 +31,7 @@
|
|||
#include "opt_mbuftrace.h"
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.53 2014/04/04 12:53:04 bouyer Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.54 2014/05/13 19:36:16 bouyer Exp $");
|
||||
|
||||
/*
|
||||
* TODO:
|
||||
|
@ -355,6 +355,7 @@ carp_setroute(struct carp_softc *sc, int cmd)
|
|||
struct ifaddr *ifa;
|
||||
int s;
|
||||
|
||||
KERNEL_LOCK(1, NULL);
|
||||
s = splsoftnet();
|
||||
IFADDR_FOREACH(ifa, &sc->sc_if) {
|
||||
switch (ifa->ifa_addr->sa_family) {
|
||||
|
@ -452,6 +453,7 @@ carp_setroute(struct carp_softc *sc, int cmd)
|
|||
}
|
||||
}
|
||||
splx(s);
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -866,6 +868,7 @@ carpdetach(struct carp_softc *sc)
|
|||
carp_setrun(sc, 0);
|
||||
carp_multicast_cleanup(sc);
|
||||
|
||||
KERNEL_LOCK(1, NULL);
|
||||
s = splnet();
|
||||
if (sc->sc_carpdev != NULL) {
|
||||
/* XXX linkstatehook removal */
|
||||
|
@ -879,6 +882,7 @@ carpdetach(struct carp_softc *sc)
|
|||
}
|
||||
sc->sc_carpdev = NULL;
|
||||
splx(s);
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
}
|
||||
|
||||
/* Detach an interface from the carp. */
|
||||
|
@ -945,6 +949,7 @@ carp_send_ad(void *v)
|
|||
struct ifaddr *ifa;
|
||||
struct sockaddr sa;
|
||||
|
||||
KERNEL_LOCK(1, NULL);
|
||||
s = splsoftnet();
|
||||
|
||||
advbase = advskew = 0; /* Sssssh compiler */
|
||||
|
@ -1147,6 +1152,7 @@ carp_send_ad(void *v)
|
|||
|
||||
retry_later:
|
||||
splx(s);
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
if (advbase != 255 || advskew != 255)
|
||||
callout_schedule(&sc->sc_ad_tmo, tvtohz(&tv));
|
||||
}
|
||||
|
@ -1161,8 +1167,10 @@ carp_send_arp(struct carp_softc *sc)
|
|||
{
|
||||
struct ifaddr *ifa;
|
||||
struct in_addr *in;
|
||||
int s = splsoftnet();
|
||||
int s;
|
||||
|
||||
KERNEL_LOCK(1, NULL);
|
||||
s = splsoftnet();
|
||||
IFADDR_FOREACH(ifa, &sc->sc_if) {
|
||||
|
||||
if (ifa->ifa_addr->sa_family != AF_INET)
|
||||
|
@ -1172,6 +1180,7 @@ carp_send_arp(struct carp_softc *sc)
|
|||
arprequest(sc->sc_carpdev, in, in, CLLADDR(sc->sc_if.if_sadl));
|
||||
}
|
||||
splx(s);
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
}
|
||||
|
||||
#ifdef INET6
|
||||
|
@ -1181,7 +1190,10 @@ carp_send_na(struct carp_softc *sc)
|
|||
struct ifaddr *ifa;
|
||||
struct in6_addr *in6;
|
||||
static struct in6_addr mcast = IN6ADDR_LINKLOCAL_ALLNODES_INIT;
|
||||
int s = splsoftnet();
|
||||
int s;
|
||||
|
||||
KERNEL_LOCK(1, NULL);
|
||||
s = splsoftnet();
|
||||
|
||||
IFADDR_FOREACH(ifa, &sc->sc_if) {
|
||||
|
||||
|
@ -1193,6 +1205,7 @@ carp_send_na(struct carp_softc *sc)
|
|||
ND_NA_FLAG_OVERRIDE, 1, NULL);
|
||||
}
|
||||
splx(s);
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
}
|
||||
#endif /* INET6 */
|
||||
|
||||
|
@ -1605,10 +1618,12 @@ carp_set_ifp(struct carp_softc *sc, struct ifnet *ifp)
|
|||
if (sc->sc_naddrs || sc->sc_naddrs6)
|
||||
sc->sc_if.if_flags |= IFF_UP;
|
||||
carp_set_enaddr(sc);
|
||||
KERNEL_LOCK(1, NULL);
|
||||
s = splnet();
|
||||
/* XXX linkstatehooks establish */
|
||||
carp_carpdev_state(ifp);
|
||||
splx(s);
|
||||
KERNEL_UNLOCK_ONE(NULL);
|
||||
} else {
|
||||
carpdetach(sc);
|
||||
sc->sc_if.if_flags &= ~(IFF_UP|IFF_RUNNING);
|
||||
|
@ -2072,6 +2087,7 @@ carp_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *sa,
|
|||
struct rtentry *rt)
|
||||
{
|
||||
struct carp_softc *sc = ((struct carp_softc *)ifp->if_softc);
|
||||
KASSERT(KERNEL_LOCKED_P());
|
||||
|
||||
if (sc->sc_carpdev != NULL && sc->sc_state == MASTER) {
|
||||
return (sc->sc_carpdev->if_output(ifp, m, sa, rt));
|
||||
|
|
Loading…
Reference in New Issue