Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net Make sure to call ifp->if_output() with KERNEL_LOCK ...
details: https://anonhg.NetBSD.org/src/rev/bddd5e9aed21
branches: trunk
changeset: 797422:bddd5e9aed21
user: bouyer <bouyer%NetBSD.org@localhost>
date: Thu Jul 17 10:46:57 2014 +0000
description:
Make sure to call ifp->if_output() with KERNEL_LOCK held.
Should fix mpls-related atf tests.
diffstat:
sys/net/if_mpls.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diffs (47 lines):
diff -r 19065f00d2bb -r bddd5e9aed21 sys/net/if_mpls.c
--- a/sys/net/if_mpls.c Thu Jul 17 10:21:51 2014 +0000
+++ b/sys/net/if_mpls.c Thu Jul 17 10:46:57 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_mpls.c,v 1.15 2014/07/09 14:41:42 rtr Exp $ */
+/* $NetBSD: if_mpls.c,v 1.16 2014/07/17 10:46:57 bouyer Exp $ */
/*
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_mpls.c,v 1.15 2014/07/09 14:41:42 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mpls.c,v 1.16 2014/07/17 10:46:57 bouyer Exp $");
#include "opt_inet.h"
#include "opt_mpls.h"
@@ -205,6 +205,8 @@
int err;
uint psize = sizeof(struct sockaddr_mpls);
+ KASSERT(KERNEL_LOCKED_P());
+
if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) {
m_freem(m);
return ENETDOWN;
@@ -448,6 +450,7 @@
mpls_send_frame(struct mbuf *m, struct ifnet *ifp, struct rtentry *rt)
{
union mpls_shim msh;
+ int ret;
if ((rt->rt_flags & RTF_GATEWAY) == 0)
return EHOSTUNREACH;
@@ -466,7 +469,10 @@
case IFT_ETHER:
case IFT_TUNNEL:
case IFT_LOOP:
- return (*ifp->if_output)(ifp, m, rt->rt_gateway, rt);
+ KERNEL_LOCK(1, NULL);
+ ret = (*ifp->if_output)(ifp, m, rt->rt_gateway, rt);
+ KERNEL_UNLOCK_ONE(NULL);
+ return ret;
break;
default:
return ENETUNREACH;
Home |
Main Index |
Thread Index |
Old Index