From 9ca4957b0bf957d4e3a97547c791aeac34911aaf Mon Sep 17 00:00:00 2001 From: jan Date: Tue, 31 Aug 2021 12:24:15 +0000 Subject: [PATCH] Using suser() instead of doing it manually. ok patrick@ --- sys/arch/riscv64/dev/sfuart.c | 4 ++-- sys/dev/fdt/amluart.c | 4 ++-- sys/dev/fdt/imxuart.c | 4 ++-- sys/dev/fdt/mvuart.c | 4 ++-- sys/dev/ic/pluart.c | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sys/arch/riscv64/dev/sfuart.c b/sys/arch/riscv64/dev/sfuart.c index eb7bad9faca..f048ae88f69 100644 --- a/sys/arch/riscv64/dev/sfuart.c +++ b/sys/arch/riscv64/dev/sfuart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sfuart.c,v 1.3 2021/06/20 17:55:37 kettenis Exp $ */ +/* $OpenBSD: sfuart.c,v 1.4 2021/08/31 12:24:15 jan Exp $ */ /* * Copyright (c) 2019 Mark Kettenis * @@ -398,7 +398,7 @@ sfuartopen(dev_t dev, int flag, int mode, struct proc *p) /* No carrier detect support. */ SET(tp->t_state, TS_CARR_ON); - } else if (ISSET(tp->t_state, TS_XCLUDE) && p->p_ucred->cr_uid != 0) + } else if (ISSET(tp->t_state, TS_XCLUDE) && suser(p) != 0) return EBUSY; else s = spltty(); diff --git a/sys/dev/fdt/amluart.c b/sys/dev/fdt/amluart.c index 0cc9ec572d6..3474446f6c8 100644 --- a/sys/dev/fdt/amluart.c +++ b/sys/dev/fdt/amluart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: amluart.c,v 1.1 2019/08/26 09:10:22 kettenis Exp $ */ +/* $OpenBSD: amluart.c,v 1.2 2021/08/31 12:24:15 jan Exp $ */ /* * Copyright (c) 2019 Mark Kettenis * @@ -396,7 +396,7 @@ amluartopen(dev_t dev, int flag, int mode, struct proc *p) /* No carrier detect support. */ SET(tp->t_state, TS_CARR_ON); - } else if (ISSET(tp->t_state, TS_XCLUDE) && p->p_ucred->cr_uid != 0) + } else if (ISSET(tp->t_state, TS_XCLUDE) && suser(p) != 0) return EBUSY; else s = spltty(); diff --git a/sys/dev/fdt/imxuart.c b/sys/dev/fdt/imxuart.c index 12bff1f08f8..1cec08ef5fa 100644 --- a/sys/dev/fdt/imxuart.c +++ b/sys/dev/fdt/imxuart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imxuart.c,v 1.9 2021/02/04 22:40:04 patrick Exp $ */ +/* $OpenBSD: imxuart.c,v 1.10 2021/08/31 12:24:15 jan Exp $ */ /* * Copyright (c) 2005 Dale Rahn * @@ -572,7 +572,7 @@ imxuartopen(dev_t dev, int flag, int mode, struct proc *p) SET(tp->t_state, TS_CARR_ON); /* XXX */ - } else if (ISSET(tp->t_state, TS_XCLUDE) && p->p_ucred->cr_uid != 0) + } else if (ISSET(tp->t_state, TS_XCLUDE) && suser(p) != 0) return EBUSY; else s = spltty(); diff --git a/sys/dev/fdt/mvuart.c b/sys/dev/fdt/mvuart.c index 3d0229a396a..52cc8b98b74 100644 --- a/sys/dev/fdt/mvuart.c +++ b/sys/dev/fdt/mvuart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mvuart.c,v 1.2 2019/07/19 00:17:15 cheloha Exp $ */ +/* $OpenBSD: mvuart.c,v 1.3 2021/08/31 12:24:15 jan Exp $ */ /* * Copyright (c) 2005 Dale Rahn * Copyright (c) 2018 Patrick Wildt @@ -425,7 +425,7 @@ mvuartopen(dev_t dev, int flag, int mode, struct proc *p) HSET4(sc, MVUART_CTRL, MVUART_CTRL_RX_RDY_INT); SET(tp->t_state, TS_CARR_ON); /* XXX */ - } else if (ISSET(tp->t_state, TS_XCLUDE) && p->p_ucred->cr_uid != 0) + } else if (ISSET(tp->t_state, TS_XCLUDE) && suser(p) != 0) return EBUSY; else s = spltty(); diff --git a/sys/dev/ic/pluart.c b/sys/dev/ic/pluart.c index 4548848afc2..b272c0bb093 100644 --- a/sys/dev/ic/pluart.c +++ b/sys/dev/ic/pluart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pluart.c,v 1.5 2020/01/10 04:10:15 cheloha Exp $ */ +/* $OpenBSD: pluart.c,v 1.6 2021/08/31 12:24:15 jan Exp $ */ /* * Copyright (c) 2014 Patrick Wildt * Copyright (c) 2005 Dale Rahn @@ -538,7 +538,7 @@ pluartopen(dev_t dev, int flag, int mode, struct proc *p) SET(tp->t_state, TS_CARR_ON); /* XXX */ - } else if (ISSET(tp->t_state, TS_XCLUDE) && p->p_ucred->cr_uid != 0) + } else if (ISSET(tp->t_state, TS_XCLUDE) && suser(p) != 0) return EBUSY; else s = spltty(); -- 2.20.1