From owner-freebsd-bugs Fri Dec 1 14:20:11 2000 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 423E137B401 for ; Fri, 1 Dec 2000 14:20:01 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id eB1MK1p64219; Fri, 1 Dec 2000 14:20:01 -0800 (PST) (envelope-from gnats) Received: from orthanc.ab.ca (207-167-15-66.dsl.worldgate.ca [207.167.15.66]) by hub.freebsd.org (Postfix) with ESMTP id 7679537B400 for ; Fri, 1 Dec 2000 14:11:44 -0800 (PST) Received: (from lyndon@localhost) by orthanc.ab.ca (8.11.1/8.11.0.Beta3) id eB1MBcX32861; Fri, 1 Dec 2000 15:11:38 -0700 (MST) Message-Id: <200012012211.eB1MBcX32861@orthanc.ab.ca> Date: Fri, 1 Dec 2000 15:11:38 -0700 (MST) From: Lyndon Nerenberg Reply-To: lyndon@orthanc.ab.ca To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: kern/23216: [PATCH] PCIOCGETCONF requires write permissions Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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