summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2001-06-24 04:18:42 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2001-06-24 04:18:42 +0000
commited9605efc00facecb56e423d3b8ad7f5ae82b1eb (patch)
tree7f56965fdff0cf7b38bff11bb4d35ffc8a93737a
parentdd0ffa18ea81ac0e8709ffc3a840c00e51aeeb2d (diff)
allow ioctl(..., PCIOCREAD, ...) if the device was opened O_READONLY
-rw-r--r--sys/dev/pci/pci.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index e29c0f7f528..42a96626fe2 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pci.c,v 1.17 2001/06/23 03:30:37 matthieu Exp $ */
+/* $OpenBSD: pci.c,v 1.18 2001/06/24 04:18:41 matthieu Exp $ */
/* $NetBSD: pci.c,v 1.31 1997/06/06 23:48:04 thorpej Exp $ */
/*
@@ -405,10 +405,6 @@ pciioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
goto done;
}
- if (!(flag & FWRITE))
- return EPERM;
-
-
tag = pci_make_tag(pc, io->pi_sel.pc_bus, io->pi_sel.pc_dev,
io->pi_sel.pc_func);
@@ -433,6 +429,9 @@ pciioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
break;
case PCIOCWRITE:
+ if (!(flag & FWRITE))
+ return EPERM;
+
switch(io->pi_width) {
case 4:
/* Make sure the register is properly aligned */