Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net Use IFADDR_WRITER_FOREACH instead of IFADDR_READER_F...
details: https://anonhg.NetBSD.org/src/rev/9adc9717384a
branches: trunk
changeset: 357990:9adc9717384a
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Thu Dec 07 01:23:53 2017 +0000
description:
Use IFADDR_WRITER_FOREACH instead of IFADDR_READER_FOREACH
At that point no other one modifies the list so IFADDR_READER_FOREACH
is unnecessary. Use of IFADDR_READER_FOREACH is harmless in general though,
if we try to detect contract violations of pserialize, using it violates
the contract. So avoid using it makes life easy.
diffstat:
sys/net/if.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diffs (32 lines):
diff -r 523b9d5bdde6 -r 9adc9717384a sys/net/if.c
--- a/sys/net/if.c Thu Dec 07 00:38:38 2017 +0000
+++ b/sys/net/if.c Thu Dec 07 01:23:53 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if.c,v 1.406 2017/12/06 09:54:47 ozaki-r Exp $ */
+/* $NetBSD: if.c,v 1.407 2017/12/07 01:23:53 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.406 2017/12/06 09:54:47 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.407 2017/12/07 01:23:53 ozaki-r Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -1378,9 +1378,11 @@
again:
/*
* At this point, no other one tries to remove ifa in the list,
- * so we don't need to take a lock or psref.
+ * so we don't need to take a lock or psref. Avoid using
+ * IFADDR_READER_FOREACH to pass over an inspection of contract
+ * violations of pserialize.
*/
- IFADDR_READER_FOREACH(ifa, ifp) {
+ IFADDR_WRITER_FOREACH(ifa, ifp) {
family = ifa->ifa_addr->sa_family;
#ifdef IFAREF_DEBUG
printf("if_detach: ifaddr %p, family %d, refcnt %d\n",
Home |
Main Index |
Thread Index |
Old Index