CVS commit: [netbsd-5-2] src/sys/dev/pci

2014-08-27 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Aug 27 06:17:06 UTC 2014

Modified Files:
src/sys/dev/pci [netbsd-5-2]: pci_usrreq.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1922):
sys/dev/pci/pci_usrreq.c1.26 via patch

Fix to make pci(4) reject unaligned configuration register reads and writes
before feeding them to a kassert in pci_conf_read/write or to a trap in the
hardware itself.


To generate a diff of this commit:
cvs rdiff -u -r1.16.6.3 -r1.16.6.3.6.1 src/sys/dev/pci/pci_usrreq.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/pci_usrreq.c
diff -u src/sys/dev/pci/pci_usrreq.c:1.16.6.3 src/sys/dev/pci/pci_usrreq.c:1.16.6.3.6.1
--- src/sys/dev/pci/pci_usrreq.c:1.16.6.3	Tue Sep 15 06:48:49 2009
+++ src/sys/dev/pci/pci_usrreq.c	Wed Aug 27 06:17:06 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_usrreq.c,v 1.16.6.3 2009/09/15 06:48:49 snj Exp $	*/
+/*	$NetBSD: pci_usrreq.c,v 1.16.6.3.6.1 2014/08/27 06:17:06 msaitoh Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pci_usrreq.c,v 1.16.6.3 2009/09/15 06:48:49 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: pci_usrreq.c,v 1.16.6.3.6.1 2014/08/27 06:17:06 msaitoh Exp $);
 
 #include sys/param.h
 #include sys/conf.h
@@ -83,7 +83,7 @@ pciioctl(dev_t dev, u_long cmd, void *da
 	case PCI_IOC_BDF_CFGREAD:
 	case PCI_IOC_BDF_CFGWRITE:
 		if (bdfr-bus  255 || bdfr-device = sc-sc_maxndevs ||
-		bdfr-function  7)
+		bdfr-function  7 || ISSET(bdfr-cfgreg.reg, 3))
 			return (EINVAL);
 		tag = pci_make_tag(sc-sc_pc, bdfr-bus, bdfr-device,
 		bdfr-function);



CVS commit: [netbsd-5-2] src/sys/dev/pci

2014-08-27 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Aug 27 06:17:06 UTC 2014

Modified Files:
src/sys/dev/pci [netbsd-5-2]: pci_usrreq.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1922):
sys/dev/pci/pci_usrreq.c1.26 via patch

Fix to make pci(4) reject unaligned configuration register reads and writes
before feeding them to a kassert in pci_conf_read/write or to a trap in the
hardware itself.


To generate a diff of this commit:
cvs rdiff -u -r1.16.6.3 -r1.16.6.3.6.1 src/sys/dev/pci/pci_usrreq.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.