Date: Fri, 1 Dec 2000 15:11:38 -0700 (MST) From: Lyndon Nerenberg <lyndon@orthanc.ab.ca> To: FreeBSD-gnats-submit@freebsd.org Subject: kern/23216: [PATCH] PCIOCGETCONF requires write permissions Message-ID: <200012012211.eB1MBcX32861@orthanc.ab.ca>
next in thread | raw e-mail | index | archive | help
>Number: 23216
>Category: kern
>Synopsis: [PATCH] PCIOCGETCONF ioctl requires write permissions
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Dec 01 14:20:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator: Lyndon Nerenberg
>Release: FreeBSD 4.2-STABLE i386
>Organization:
The Frobozz Magic Homing Pigeon Company
>Environment:
>Description:
/sys/pci/pci.c:pci_ioctl() fails all ioctl operations unless the caller
has /dev/pci opened for write. This causes 'pciconf -l' to fail when
run as a non-superuser. (A patch to pciconf to open /dev/pci read
only in the -l case follows in another pr.)
>How-To-Repeat:
Issue a PCIOCGETCONF request with /dev/pci opened read only.
>Fix:
Index: pci.c
===================================================================
RCS file: /home/ncvs/src/sys/pci/pci.c,v
retrieving revision 1.141.2.4
diff -u -u -r1.141.2.4 pci.c
--- pci.c 2000/10/28 23:10:17 1.141.2.4
+++ pci.c 2000/12/01 22:04:29
@@ -552,10 +552,6 @@
const char *name;
int error;
- if (!(flag & FWRITE))
- return EPERM;
-
-
switch(cmd) {
case PCIOCGETCONF:
{
@@ -787,6 +783,9 @@
break;
}
case PCIOCREAD:
+ if (!(flag & FWRITE))
+ return EPERM;
+
io = (struct pci_io *)data;
switch(io->pi_width) {
pcicfgregs probe;
@@ -808,6 +807,9 @@
break;
case PCIOCWRITE:
+ if (!(flag & FWRITE))
+ return EPERM;
+
io = (struct pci_io *)data;
switch(io->pi_width) {
pcicfgregs probe;
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200012012211.eB1MBcX32861>
