CVS commit: src/sys/net

2017-04-03 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Tue Apr  4 04:34:43 UTC 2017

Modified Files:
src/sys/net: if_l2tp.c

Log Message:
fix atf failed.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/net/if_l2tp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/if_l2tp.c
diff -u src/sys/net/if_l2tp.c:1.4 src/sys/net/if_l2tp.c:1.5
--- src/sys/net/if_l2tp.c:1.4	Mon Apr  3 10:17:17 2017
+++ src/sys/net/if_l2tp.c	Tue Apr  4 04:34:43 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_l2tp.c,v 1.4 2017/04/03 10:17:17 knakahara Exp $	*/
+/*	$NetBSD: if_l2tp.c,v 1.5 2017/04/04 04:34:43 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.4 2017/04/03 10:17:17 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.5 2017/04/04 04:34:43 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -298,6 +298,7 @@ l2tp_ro_fini_pc(void *p, void *arg __unu
 static int
 l2tp_clone_destroy(struct ifnet *ifp)
 {
+	struct l2tp_variant *var;
 	struct l2tp_softc *sc = container_of(ifp, struct l2tp_softc,
 	l2tp_ec.ec_if);
 
@@ -307,6 +308,7 @@ l2tp_clone_destroy(struct ifnet *ifp)
 	 * To avoid for l2tp_transmit() to access sc->l2tp_var after free it.
 	 */
 	mutex_enter(>l2tp_lock);
+	var = sc->l2tp_var;
 	l2tp_variant_update(sc, NULL);
 	mutex_exit(>l2tp_lock);
 
@@ -321,7 +323,7 @@ l2tp_clone_destroy(struct ifnet *ifp)
 	percpu_foreach(sc->l2tp_ro_percpu, l2tp_ro_fini_pc, NULL);
 	percpu_free(sc->l2tp_ro_percpu, sizeof(struct l2tp_ro));
 
-	kmem_free(sc->l2tp_var, sizeof(struct l2tp_variant));
+	kmem_free(var, sizeof(struct l2tp_variant));
 	mutex_destroy(>l2tp_lock);
 	kmem_free(sc, sizeof(struct l2tp_softc));
 
@@ -1166,10 +1168,13 @@ l2tp_variant_update(struct l2tp_softc *s
 	 * In the manual of atomic_swap_ptr(3), there is no mention if 2nd
 	 * argument is rewrite or not. So, use sc->l2tp_var instead of nvar.
 	 */
-	if (sc->l2tp_var->lv_psrc != NULL && sc->l2tp_var->lv_pdst != NULL)
-		ifp->if_flags |= IFF_RUNNING;
-	else
-		ifp->if_flags &= ~IFF_RUNNING;
+	if (sc->l2tp_var != NULL) {
+		if (sc->l2tp_var->lv_psrc != NULL
+		&& sc->l2tp_var->lv_pdst != NULL)
+			ifp->if_flags |= IFF_RUNNING;
+		else
+			ifp->if_flags &= ~IFF_RUNNING;
+	}
 }
 
 static int



CVS commit: src/sys/dev/ic

2017-04-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr  3 17:40:07 UTC 2017

Modified Files:
src/sys/dev/ic: igsfb_subr.c

Log Message:
PR/52136: David Binderman: Rewrite loop to fix bounds check.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ic/igsfb_subr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/igsfb_subr.c
diff -u src/sys/dev/ic/igsfb_subr.c:1.13 src/sys/dev/ic/igsfb_subr.c:1.14
--- src/sys/dev/ic/igsfb_subr.c:1.13	Wed Jan 25 12:31:55 2017
+++ src/sys/dev/ic/igsfb_subr.c	Mon Apr  3 13:40:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: igsfb_subr.c,v 1.13 2017/01/25 17:31:55 jakllsch Exp $ */
+/*	$NetBSD: igsfb_subr.c,v 1.14 2017/04/03 17:40:07 christos Exp $ */
 
 /*
  * Copyright (c) 2002 Valeriy E. Ushakov
@@ -32,7 +32,7 @@
  * Integraphics Systems IGA 168x and CyberPro series.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: igsfb_subr.c,v 1.13 2017/01/25 17:31:55 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: igsfb_subr.c,v 1.14 2017/04/03 17:40:07 christos Exp $");
 
 #include 
 #include 
@@ -436,10 +436,9 @@ igsfb_hw_setup(struct igsfb_devconfig *d
 	igsfb_init_ext(dc);
 	igsfb_init_dac(dc);
 
-	i = 0;
-	while ((strcmp(dc->dc_modestring, videomode_list[i].name) != 0) &&	
-	   ( i < videomode_count)) {
-		i++;
+	for (i = 0; i < videomode_count; i++) {
+		if (strcmp(dc->dc_modestring, videomode_list[i].name) == 0)
+			break;
 	}
 
 	if (i < videomode_count) {



CVS commit: src/sys/arch/x68k/x68k

2017-04-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr  3 17:37:29 UTC 2017

Modified Files:
src/sys/arch/x68k/x68k: machdep.c

Log Message:
PR/52135: David Binderman: Fix loop bounds checking.


To generate a diff of this commit:
cvs rdiff -u -r1.195 -r1.196 src/sys/arch/x68k/x68k/machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x68k/x68k/machdep.c
diff -u src/sys/arch/x68k/x68k/machdep.c:1.195 src/sys/arch/x68k/x68k/machdep.c:1.196
--- src/sys/arch/x68k/x68k/machdep.c:1.195	Fri Dec 23 02:15:28 2016
+++ src/sys/arch/x68k/x68k/machdep.c	Mon Apr  3 13:37:29 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.195 2016/12/23 07:15:28 cherry Exp $	*/
+/*	$NetBSD: machdep.c,v 1.196 2017/04/03 17:37:29 christos Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.195 2016/12/23 07:15:28 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.196 2017/04/03 17:37:29 christos Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -693,7 +693,7 @@ cpu_dumpconf(void)
 	chdrsize = cpu_dumpsize();
 
 	dumpsize = 0;
-	for (i = 0; m->ram_segs[i].size && i < M68K_NPHYS_RAM_SEGS; i++)
+	for (i = 0; i < M68K_NPHYS_RAM_SEGS && m->ram_segs[i].size; i++)
 		dumpsize += btoc(m->ram_segs[i].size);
 	/*
 	 * Check to see if we will fit.  Note we always skip the



CVS commit: src/sys/arch/mac68k/mac68k

2017-04-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr  3 17:36:17 UTC 2017

Modified Files:
src/sys/arch/mac68k/mac68k: machdep.c

Log Message:
PR/52134: David Binderman: Fix loop bounds checking.


To generate a diff of this commit:
cvs rdiff -u -r1.349 -r1.350 src/sys/arch/mac68k/mac68k/machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/mac68k/mac68k/machdep.c
diff -u src/sys/arch/mac68k/mac68k/machdep.c:1.349 src/sys/arch/mac68k/mac68k/machdep.c:1.350
--- src/sys/arch/mac68k/mac68k/machdep.c:1.349	Sat Aug 29 21:46:03 2015
+++ src/sys/arch/mac68k/mac68k/machdep.c	Mon Apr  3 13:36:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.349 2015/08/30 01:46:03 uebayasi Exp $	*/
+/*	$NetBSD: machdep.c,v 1.350 2017/04/03 17:36:17 christos Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -74,7 +74,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.349 2015/08/30 01:46:03 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.350 2017/04/03 17:36:17 christos Exp $");
 
 #include "opt_adb.h"
 #include "opt_copy_symtab.h"
@@ -646,7 +646,7 @@ cpu_dumpconf(void)
 	chdrsize = cpu_dumpsize();
 
 	dumpsize = 0;
-	for (i = 0; m->ram_segs[i].size && i < M68K_NPHYS_RAM_SEGS; i++)
+	for (i = 0; i < M68K_NPHYS_RAM_SEGS && m->ram_segs[i].size; i++)
 		dumpsize += btoc(m->ram_segs[i].size);
 
 	/*



CVS commit: src/sys/arch/ia64/include

2017-04-03 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Mon Apr  3 17:19:43 UTC 2017

Modified Files:
src/sys/arch/ia64/include: isa_machdep.h

Log Message:
com_isa uses isa_intr_establish_xname now, fixes GENERIC compilation


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/ia64/include/isa_machdep.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/ia64/include/isa_machdep.h
diff -u src/sys/arch/ia64/include/isa_machdep.h:1.2 src/sys/arch/ia64/include/isa_machdep.h:1.3
--- src/sys/arch/ia64/include/isa_machdep.h:1.2	Tue Oct 18 22:04:34 2016
+++ src/sys/arch/ia64/include/isa_machdep.h	Mon Apr  3 17:19:43 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: isa_machdep.h,v 1.2 2016/10/18 22:04:34 jdolecek Exp $	*/
+/*	$NetBSD: isa_machdep.h,v 1.3 2017/04/03 17:19:43 scole Exp $	*/
 /*
  * Copyright (c) 2009 KIYOHARA Takashi
  * All rights reserved.
@@ -37,7 +37,8 @@ isa_intr_establish(isa_chipset_tag_t ic,
 	return intr_establish(irq, type, level, ih_func, ih_arg);
 }
 
-void *isa_intr_establish_xname(isa_chipset_tag_t, int, int, int,
-		   int (*)(void *), void *, const char *);
+/* XXX - com_isa.c requires _xname now */
+#define isa_intr_establish_xname(ic, irq, type, level, fun, arg, xname) \
+	isa_intr_establish(ic, irq, type, level, fun, arg)
 
 #endif	/* _ISA_MACHDEP_H_ */



CVS commit: src/bin/sh

2017-04-03 Thread Abhinav Upadhyay
Module Name:src
Committed By:   abhinav
Date:   Mon Apr  3 14:08:37 UTC 2017

Modified Files:
src/bin/sh: sh.1

Log Message:
Use \- instead of .Fl for the -number argument.

.Fl causes the -number argument to be rendered in bold, which causes confusion
with the [+]number argument right above it.

ok wiz@


To generate a diff of this commit:
cvs rdiff -u -r1.128 -r1.129 src/bin/sh/sh.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.128 src/bin/sh/sh.1:1.129
--- src/bin/sh/sh.1:1.128	Thu Mar 23 12:10:53 2017
+++ src/bin/sh/sh.1	Mon Apr  3 14:08:37 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.128 2017/03/23 12:10:53 kre Exp $
+.\"	$NetBSD: sh.1,v 1.129 2017/04/03 14:08:37 abhinav Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -1706,7 +1706,7 @@ A positive number representing a command
 displayed with the
 .Fl l
 option.
-.It Fl number
+.It \-number
 A negative decimal number representing the command that was executed
 number of commands previously.
 For example, \-1 is the immediately previous command.



CVS commit: src/sys/net

2017-04-03 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Mon Apr  3 10:17:17 UTC 2017

Modified Files:
src/sys/net: if_l2tp.c

Log Message:
fix missing mutex_destroy when modunload.

pointed out by s-yamaguchi@IIJ, thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/net/if_l2tp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/if_l2tp.c
diff -u src/sys/net/if_l2tp.c:1.3 src/sys/net/if_l2tp.c:1.4
--- src/sys/net/if_l2tp.c:1.3	Mon Apr  3 10:08:24 2017
+++ src/sys/net/if_l2tp.c	Mon Apr  3 10:17:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_l2tp.c,v 1.3 2017/04/03 10:08:24 knakahara Exp $	*/
+/*	$NetBSD: if_l2tp.c,v 1.4 2017/04/03 10:17:17 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.3 2017/04/03 10:08:24 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.4 2017/04/03 10:17:17 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -218,6 +218,8 @@ l2tpdetach(void)
 	pserialize_destroy(l2tp_psz);
 	mutex_destroy(_hash.lock);
 
+	mutex_destroy(_softcs.lock);
+
 	return error;
 }
 



CVS commit: src/sys/net

2017-04-03 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Mon Apr  3 10:08:24 UTC 2017

Modified Files:
src/sys/net: if_l2tp.c

Log Message:
fix potentially use after free between "ifconfig l2tpX destroy" and l2tp Tx.

It is protected by KERNEL_LOCK in soo_ioctl() between "ioctl destory" and
other ioctls. And, it is protected by encap_lock() between "ioctl destroy"
and Rx. However, it was not protected between "ioctl destroy" and Tx.
That is,
+ CPU#A
  - do "ifconfig l2tpX destroy"
- call l2tp_clone_destroy()
- done l2tp_delete_tunnel()
+ CPU#B
  - begin l2tp output processing
- call l2tp_transmit()
- done l2tp_getref_variant()
+ CPU#A
- done kmem_free(sc->l2tp_var, )
+ CPU#B
- access to sc->l2tp_var after free

pointed out by s-yamaguchi@IIJ, thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/net/if_l2tp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/if_l2tp.c
diff -u src/sys/net/if_l2tp.c:1.2 src/sys/net/if_l2tp.c:1.3
--- src/sys/net/if_l2tp.c:1.2	Thu Mar 30 06:42:05 2017
+++ src/sys/net/if_l2tp.c	Mon Apr  3 10:08:24 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_l2tp.c,v 1.2 2017/03/30 06:42:05 knakahara Exp $	*/
+/*	$NetBSD: if_l2tp.c,v 1.3 2017/04/03 10:08:24 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.2 2017/03/30 06:42:05 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.3 2017/04/03 10:08:24 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -301,6 +301,12 @@ l2tp_clone_destroy(struct ifnet *ifp)
 
 	l2tp_clear_session(sc);
 	l2tp_delete_tunnel(>l2tp_ec.ec_if);
+	/*
+	 * To avoid for l2tp_transmit() to access sc->l2tp_var after free it.
+	 */
+	mutex_enter(>l2tp_lock);
+	l2tp_variant_update(sc, NULL);
+	mutex_exit(>l2tp_lock);
 
 	mutex_enter(_softcs.lock);
 	LIST_REMOVE(sc, l2tp_list);



CVS commit: src

2017-04-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Apr  3 09:37:58 UTC 2017

Modified Files:
src: UPDATING

Log Message:
New dhcpcd does not like update builds from previous versions.


To generate a diff of this commit:
cvs rdiff -u -r1.283 -r1.284 src/UPDATING

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/UPDATING
diff -u src/UPDATING:1.283 src/UPDATING:1.284
--- src/UPDATING:1.283	Fri Feb 17 21:34:19 2017
+++ src/UPDATING	Mon Apr  3 09:37:58 2017
@@ -1,4 +1,4 @@
-$NetBSD: UPDATING,v 1.283 2017/02/17 21:34:19 kamil Exp $
+$NetBSD: UPDATING,v 1.284 2017/04/03 09:37:58 martin Exp $
 
 This file (UPDATING) is intended to be a brief reference to recent
 changes that might cause problems in the build process, and a guide for
@@ -19,6 +19,11 @@ See also: BUILDING, build.sh, Makefile.
 Recent changes:
 ^^^
 
+20170402:
+	a new version of dhcpcd has been imported, which does not support
+	update builds from the previous version. Remove your
+	external/bsd/dhcpcd object dir or build once without -u.
+
 20170211:
 	a new terminfo database has been imported.
 	The structure of it has changed slightly from prior versions and