PR port-sparc64/52622: mark the parent device as TS_KERN_ONLY,

so userland will not touch it (and change serial params w/o our
controll).
This commit is contained in:
martin 2017-10-31 10:46:47 +00:00
parent 6e7b93fc42
commit 4908bc3fd9
2 changed files with 10 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: sunkbd.c,v 1.29 2013/09/15 14:10:04 martin Exp $ */
/* $NetBSD: sunkbd.c,v 1.30 2017/10/31 10:46:47 martin Exp $ */
/*
* Copyright (c) 1992, 1993
@ -51,7 +51,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sunkbd.c,v 1.29 2013/09/15 14:10:04 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: sunkbd.c,v 1.30 2017/10/31 10:46:47 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -145,6 +145,7 @@ sunkbd_attach(device_t parent, device_t self, void *aux)
KASSERT(tp->t_linesw == &sunkbd_disc);
tp->t_oflag &= ~OPOST;
tp->t_dev = args->kmta_dev;
SET(tp->t_state, TS_KERN_ONLY);
/* link the structures together. */
k->k_priv = tp;
@ -218,6 +219,7 @@ sunkbdiopen(device_t dev, int flags)
int error;
/* Open the lower device */
CLR(tp->t_state, TS_KERN_ONLY);
if ((error = cdev_open(tp->t_dev, O_NONBLOCK|flags,
0/* ignored? */, l)) != 0)
return (error);
@ -228,6 +230,7 @@ sunkbdiopen(device_t dev, int flags)
t.c_ospeed = sunkbd_bps;
t.c_cflag = CLOCAL|CS8;
(*tp->t_param)(tp, &t);
SET(tp->t_state, TS_KERN_ONLY);
return (0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: sunms.c,v 1.32 2013/09/15 14:13:19 martin Exp $ */
/* $NetBSD: sunms.c,v 1.33 2017/10/31 10:46:47 martin Exp $ */
/*
* Copyright (c) 1992, 1993
@ -52,7 +52,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sunms.c,v 1.32 2013/09/15 14:13:19 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: sunms.c,v 1.33 2017/10/31 10:46:47 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -162,6 +162,7 @@ sunms_attach(device_t parent, device_t self, void *aux)
tp->t_linesw = ttyldisc_lookup(sunms_disc.l_name);
KASSERT(tp->t_linesw == &sunms_disc);
tp->t_oflag &= ~OPOST;
SET(tp->t_state, TS_KERN_ONLY);
/* Initialize translator. */
ms->ms_byteno = -1;
@ -192,6 +193,7 @@ sunmsiopen(device_t dev, int flags)
int error;
/* Open the lower device */
CLR(tp->t_state, TS_KERN_ONLY);
if ((error = cdev_open(tp->t_dev, O_NONBLOCK|flags,
0/* ignored? */, l)) != 0)
return (error);
@ -202,6 +204,7 @@ sunmsiopen(device_t dev, int flags)
t.c_ospeed = sunms_bps;
t.c_cflag = CLOCAL|CS8;
(*tp->t_param)(tp, &t);
SET(tp->t_state, TS_KERN_ONLY);
return (0);
}