Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Dec 2000 15:15:54 -0700 (MST)
From:      Lyndon Nerenberg <lyndon@orthanc.ab.ca>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/23217: [PATCH] 'pciconf -l' opens /dev/pci with incorrect permissions
Message-ID:  <200012012215.eB1MFsn32985@orthanc.ab.ca>

next in thread | raw e-mail | index | archive | help

>Number:         23217
>Category:       bin
>Synopsis:       [PATCH] 'pciconf -l' opens /dev/pci with incorrect 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:01 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Lyndon Nerenberg
>Release:        FreeBSD 4.2-STABLE i386
>Organization:
The Frobozz Magic Homing Pigeon Company
>Environment:

>Description:

pciconf always opens /dev/pci with O_RDWR. For the -l case it should
open the device O_RDONLY. When combined with my /sys/pci/pci.c patch
for pci_ioctl this restores the documented behaviour of 'pciconf -l'
being available to mortal users.

>How-To-Repeat:

Run pciconf -l as a non-root user.

>Fix:

Index: pciconf.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/pciconf/pciconf.c,v
retrieving revision 1.11
diff -u -r1.11 pciconf.c
--- pciconf.c   1999/12/08 17:43:20     1.11
+++ pciconf.c   2000/12/01 22:11:57
@@ -134,7 +134,7 @@
        struct pci_conf conf[255], *p;
        int none_count = 0;
 
-       fd = open(_PATH_DEVPCI, O_RDWR, 0);
+       fd = open(_PATH_DEVPCI, O_RDONLY, 0);
        if (fd < 0)
                err(1, "%s", _PATH_DEVPCI);
 


>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?200012012215.eB1MFsn32985>