summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorelad <elad@NetBSD.org>2009-05-06 18:41:54 +0000
committerelad <elad@NetBSD.org>2009-05-06 18:41:54 +0000
commit105d9a093de9b461bbaede09cd60a3bd5eab31fc (patch)
tree19d1f403bc14bfef712afed7a7915d6ea4bfd650 /sys/dev
parentaf1172fad03120c47791b3583453a5689f850924 (diff)
Replace curlwp->l_cred with kauth_cred_get().
Mailing list reference: http://mail-index.netbsd.org/tech-kern/2009/05/05/msg005038.html
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/chipsfb.c16
-rw-r--r--sys/dev/pci/genfb_pci.c16
-rw-r--r--sys/dev/pci/machfb.c14
-rw-r--r--sys/dev/pci/r128fb.c18
-rw-r--r--sys/dev/pci/radeonfb.c18
-rw-r--r--sys/dev/pci/voodoofb.c14
6 files changed, 37 insertions, 59 deletions
diff --git a/sys/dev/pci/chipsfb.c b/sys/dev/pci/chipsfb.c
index 7e709dc9de3..1248e4bc4dc 100644
--- a/sys/dev/pci/chipsfb.c
+++ b/sys/dev/pci/chipsfb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: chipsfb.c,v 1.17 2009/05/06 10:34:32 cegger Exp $ */
+/* $NetBSD: chipsfb.c,v 1.18 2009/05/06 18:41:54 elad Exp $ */
/*
* Copyright (c) 2006 Michael Lorenz
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: chipsfb.c,v 1.17 2009/05/06 10:34:32 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: chipsfb.c,v 1.18 2009/05/06 18:41:54 elad Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -865,7 +865,6 @@ chipsfb_mmap(void *v, void *vs, off_t offset, int prot)
{
struct vcons_data *vd = v;
struct chipsfb_softc *sc = vd->cookie;
- struct lwp *me;
paddr_t pa;
/* 'regular' framebuffer mmap()ing */
@@ -879,13 +878,10 @@ chipsfb_mmap(void *v, void *vs, off_t offset, int prot)
* restrict all other mappings to processes with superuser privileges
* or the kernel itself
*/
- me = curlwp;
- if (me != NULL) {
- if (kauth_authorize_generic(me->l_cred, KAUTH_GENERIC_ISSUSER,
- NULL) != 0) {
- aprint_normal_dev(&sc->sc_dev, "mmap() rejected.\n");
- return -1;
- }
+ if (kauth_authorize_generic(kauth_cred_get(), KAUTH_GENERIC_ISSUSER,
+ NULL) != 0) {
+ aprint_normal_dev(&sc->sc_dev, "mmap() rejected.\n");
+ return -1;
}
if ((offset >= sc->sc_fb) && (offset < (sc->sc_fb + sc->sc_fbsize))) {
diff --git a/sys/dev/pci/genfb_pci.c b/sys/dev/pci/genfb_pci.c
index 8e51e13248a..42139c9a489 100644
--- a/sys/dev/pci/genfb_pci.c
+++ b/sys/dev/pci/genfb_pci.c
@@ -1,4 +1,4 @@
-/* $NetBSD: genfb_pci.c,v 1.18 2009/05/06 10:34:32 cegger Exp $ */
+/* $NetBSD: genfb_pci.c,v 1.19 2009/05/06 18:41:54 elad Exp $ */
/*-
* Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfb_pci.c,v 1.18 2009/05/06 10:34:32 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfb_pci.c,v 1.19 2009/05/06 18:41:54 elad Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -222,7 +222,6 @@ pci_genfb_mmap(void *v, void *vs, off_t offset, int prot)
{
struct pci_genfb_softc *sc = v;
struct range *r;
- struct lwp *me;
int i;
if (offset == 0)
@@ -247,13 +246,10 @@ pci_genfb_mmap(void *v, void *vs, off_t offset, int prot)
* restrict all other mappings to processes with superuser privileges
* or the kernel itself
*/
- me = curlwp;
- if (me != NULL) {
- if (kauth_authorize_generic(me->l_cred, KAUTH_GENERIC_ISSUSER,
- NULL) != 0) {
- aprint_normal_dev(&sc->sc_gen.sc_dev, "mmap() rejected.\n");
- return -1;
- }
+ if (kauth_authorize_generic(kauth_cred_get(), KAUTH_GENERIC_ISSUSER,
+ NULL) != 0) {
+ aprint_normal_dev(&sc->sc_gen.sc_dev, "mmap() rejected.\n");
+ return -1;
}
#ifdef WSFB_FAKE_VGA_FB
diff --git a/sys/dev/pci/machfb.c b/sys/dev/pci/machfb.c
index 26c0f94a65a..4ac06b0f471 100644
--- a/sys/dev/pci/machfb.c
+++ b/sys/dev/pci/machfb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: machfb.c,v 1.56 2009/01/03 03:43:22 yamt Exp $ */
+/* $NetBSD: machfb.c,v 1.57 2009/05/06 18:41:54 elad Exp $ */
/*
* Copyright (c) 2002 Bang Jun-Young
@@ -33,7 +33,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0,
- "$NetBSD: machfb.c,v 1.56 2009/01/03 03:43:22 yamt Exp $");
+ "$NetBSD: machfb.c,v 1.57 2009/05/06 18:41:54 elad Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1673,12 +1673,10 @@ mach64_mmap(void *v, void *vs, off_t offset, int prot)
* restrict all other mappings to processes with superuser privileges
* or the kernel itself
*/
- if (curlwp != NULL) {
- if (kauth_authorize_generic(kauth_cred_get(),
- KAUTH_GENERIC_ISSUSER, NULL) != 0) {
- printf("%s: mmap() rejected.\n", device_xname(&sc->sc_dev));
- return -1;
- }
+ if (kauth_authorize_generic(kauth_cred_get(), KAUTH_GENERIC_ISSUSER,
+ NULL) != 0) {
+ printf("%s: mmap() rejected.\n", device_xname(&sc->sc_dev));
+ return -1;
}
reg = (pci_conf_read(sc->sc_pc, sc->sc_pcitag, 0x18) & 0xffffff00);
diff --git a/sys/dev/pci/r128fb.c b/sys/dev/pci/r128fb.c
index 0f74a264014..e62c3ac9e51 100644
--- a/sys/dev/pci/r128fb.c
+++ b/sys/dev/pci/r128fb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: r128fb.c,v 1.7 2009/01/03 03:43:22 yamt Exp $ */
+/* $NetBSD: r128fb.c,v 1.8 2009/05/06 18:41:54 elad Exp $ */
/*
* Copyright (c) 2007 Michael Lorenz
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: r128fb.c,v 1.7 2009/01/03 03:43:22 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: r128fb.c,v 1.8 2009/05/06 18:41:54 elad Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -373,7 +373,6 @@ r128fb_mmap(void *v, void *vs, off_t offset, int prot)
{
struct vcons_data *vd = v;
struct r128fb_softc *sc = vd->cookie;
- struct lwp *me;
paddr_t pa;
/* 'regular' framebuffer mmap()ing */
@@ -387,14 +386,11 @@ r128fb_mmap(void *v, void *vs, off_t offset, int prot)
* restrict all other mappings to processes with superuser privileges
* or the kernel itself
*/
- me = curlwp;
- if (me != NULL) {
- if (kauth_authorize_generic(me->l_cred, KAUTH_GENERIC_ISSUSER,
- NULL) != 0) {
- aprint_normal("%s: mmap() rejected.\n",
- device_xname(sc->sc_dev));
- return -1;
- }
+ if (kauth_authorize_generic(kauth_cred_get(), KAUTH_GENERIC_ISSUSER,
+ NULL) != 0) {
+ aprint_normal("%s: mmap() rejected.\n",
+ device_xname(sc->sc_dev));
+ return -1;
}
if ((offset >= sc->sc_fb) && (offset < (sc->sc_fb + sc->sc_fbsize))) {
diff --git a/sys/dev/pci/radeonfb.c b/sys/dev/pci/radeonfb.c
index 1a7b7e9cd80..86dee0b6476 100644
--- a/sys/dev/pci/radeonfb.c
+++ b/sys/dev/pci/radeonfb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: radeonfb.c,v 1.31 2009/05/06 10:34:33 cegger Exp $ */
+/* $NetBSD: radeonfb.c,v 1.32 2009/05/06 18:41:54 elad Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.31 2009/05/06 10:34:33 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.32 2009/05/06 18:41:54 elad Exp $");
#define RADEONFB_DEFAULT_DEPTH 32
@@ -1061,9 +1061,6 @@ radeonfb_mmap(void *v, void *vs, off_t offset, int prot)
struct vcons_data *vd;
struct radeonfb_display *dp;
struct radeonfb_softc *sc;
-#ifdef RADEONFB_MMAP_BARS
- struct lwp *me;
-#endif
paddr_t pa;
vd = (struct vcons_data *)v;
@@ -1085,13 +1082,10 @@ radeonfb_mmap(void *v, void *vs, off_t offset, int prot)
* restrict all other mappings to processes with superuser privileges
* or the kernel itself
*/
- me = curlwp;
- if (me != NULL) {
- if (kauth_authorize_generic(me->l_cred, KAUTH_GENERIC_ISSUSER,
- NULL) != 0) {
- aprint_error_dev(&sc->sc_dev, "mmap() rejected.\n");
- return -1;
- }
+ if (kauth_authorize_generic(kauth_cred_get(), KAUTH_GENERIC_ISSUSER,
+ NULL) != 0) {
+ aprint_error_dev(&sc->sc_dev, "mmap() rejected.\n");
+ return -1;
}
if ((offset >= sc->sc_regaddr) &&
diff --git a/sys/dev/pci/voodoofb.c b/sys/dev/pci/voodoofb.c
index 9608974e610..d30def8b1a0 100644
--- a/sys/dev/pci/voodoofb.c
+++ b/sys/dev/pci/voodoofb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: voodoofb.c,v 1.18 2008/07/09 15:04:21 joerg Exp $ */
+/* $NetBSD: voodoofb.c,v 1.19 2009/05/06 18:41:54 elad Exp $ */
/*
* Copyright (c) 2005, 2006 Michael Lorenz
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: voodoofb.c,v 1.18 2008/07/09 15:04:21 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: voodoofb.c,v 1.19 2009/05/06 18:41:54 elad Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1002,12 +1002,10 @@ voodoofb_mmap(void *v, void *vs, off_t offset, int prot)
* restrict all other mappings to processes with superuser privileges
* or the kernel itself
*/
- if (curlwp != NULL) {
- if (kauth_authorize_generic(kauth_cred_get(),
- KAUTH_GENERIC_ISSUSER, NULL) != 0) {
- aprint_error_dev(sc->sc_dev, "mmap() rejected.\n");
- return -1;
- }
+ if (kauth_authorize_generic(kauth_cred_get(), KAUTH_GENERIC_ISSUSER,
+ NULL) != 0) {
+ aprint_error_dev(sc->sc_dev, "mmap() rejected.\n");
+ return -1;
}
if ((offset >= sc->sc_fb) && (offset < (sc->sc_fb + sc->sc_fbsize))) {