Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Ensure to call if_addr_init with holding if_ioctl_lock
details: https://anonhg.NetBSD.org/src/rev/f0f039d03cd2
branches: trunk
changeset: 357991:f0f039d03cd2
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Thu Dec 07 03:16:24 2017 +0000
description:
Ensure to call if_addr_init with holding if_ioctl_lock
diffstat:
sys/net/if.c | 5 +++--
sys/net/if_spppsubr.c | 16 ++++++++++++++--
sys/rump/net/lib/libnetinet/netinet_component.c | 6 ++++--
3 files changed, 21 insertions(+), 6 deletions(-)
diffs (126 lines):
diff -r 9adc9717384a -r f0f039d03cd2 sys/net/if.c
--- a/sys/net/if.c Thu Dec 07 01:23:53 2017 +0000
+++ b/sys/net/if.c Thu Dec 07 03:16:24 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if.c,v 1.407 2017/12/07 01:23:53 ozaki-r Exp $ */
+/* $NetBSD: if.c,v 1.408 2017/12/07 03:16:24 ozaki-r Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.407 2017/12/07 01:23:53 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.408 2017/12/07 03:16:24 ozaki-r Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -3517,6 +3517,7 @@
{
int rc;
+ KASSERT(mutex_owned(ifp->if_ioctl_lock));
if (ifp->if_initaddr != NULL)
rc = (*ifp->if_initaddr)(ifp, ifa, src);
else if (src ||
diff -r 9adc9717384a -r f0f039d03cd2 sys/net/if_spppsubr.c
--- a/sys/net/if_spppsubr.c Thu Dec 07 01:23:53 2017 +0000
+++ b/sys/net/if_spppsubr.c Thu Dec 07 03:16:24 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_spppsubr.c,v 1.175 2017/11/22 17:11:51 christos Exp $ */
+/* $NetBSD: if_spppsubr.c,v 1.176 2017/12/07 03:16:24 ozaki-r Exp $ */
/*
* Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.175 2017/11/22 17:11:51 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.176 2017/12/07 03:16:24 ozaki-r Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -5271,6 +5271,8 @@
uint32_t myaddr = 0, hisaddr = 0;
int s;
+ mutex_enter(ifp->if_ioctl_lock);
+
/*
* Pick the first AF_INET address from the list,
* aliases don't make any sense on a p2p link anyway.
@@ -5334,6 +5336,8 @@
ifp->if_xname, ifp->if_mtu);
}
+ mutex_exit(ifp->if_ioctl_lock);
+
sppp_notify_con(sp);
}
@@ -5365,6 +5369,8 @@
struct sockaddr_in *si, *dest;
int s;
+ mutex_enter(ifp->if_ioctl_lock);
+
/*
* Pick the first AF_INET address from the list,
* aliases don't make any sense on a p2p link anyway.
@@ -5414,6 +5420,8 @@
"%s: resetting MTU to %" PRIu64 " bytes\n",
ifp->if_xname, ifp->if_mtu);
}
+
+ mutex_exit(ifp->if_ioctl_lock);
}
static void
@@ -5531,6 +5539,8 @@
int s;
struct psref psref;
+ mutex_enter(ifp->if_ioctl_lock);
+
/*
* Pick the first link-local AF_INET6 address from the list,
* aliases don't make any sense on a p2p link anyway.
@@ -5568,6 +5578,8 @@
}
ifa_release(ifa, &psref);
}
+
+ mutex_exit(ifp->if_ioctl_lock);
}
#endif
diff -r 9adc9717384a -r f0f039d03cd2 sys/rump/net/lib/libnetinet/netinet_component.c
--- a/sys/rump/net/lib/libnetinet/netinet_component.c Thu Dec 07 01:23:53 2017 +0000
+++ b/sys/rump/net/lib/libnetinet/netinet_component.c Thu Dec 07 03:16:24 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netinet_component.c,v 1.8 2017/01/20 08:35:33 ozaki-r Exp $ */
+/* $NetBSD: netinet_component.c,v 1.9 2017/12/07 03:16:25 ozaki-r Exp $ */
/*
* Copyright (c) 2009 Antti Kantee. All Rights Reserved.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netinet_component.c,v 1.8 2017/01/20 08:35:33 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netinet_component.c,v 1.9 2017/12/07 03:16:25 ozaki-r Exp $");
#include <sys/param.h>
#include <sys/domain.h>
@@ -94,7 +94,9 @@
sin->sin_len = sizeof(struct sockaddr_in);
sin->sin_addr.s_addr = inet_addr("127.255.255.255");
+ mutex_enter(lo0ifp->if_ioctl_lock);
in_control(so, SIOCAIFADDR, &ia, lo0ifp);
+ mutex_exit(lo0ifp->if_ioctl_lock);
if_up(lo0ifp);
soclose(so);
}
Home |
Main Index |
Thread Index |
Old Index