Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/nvidia Limit configuration space access to the ...



details:   https://anonhg.NetBSD.org/src/rev/33f017485bcd
branches:  trunk
changeset: 341615:33f017485bcd
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Fri Nov 13 18:58:17 2015 +0000

description:
Limit configuration space access to the non-emulated busses to legacy
PCI_CONF_SIZE.  Extended configuration access is possible, we just have
to implement it without wasting up to 256MiB of KVA.

diffstat:

 sys/arch/arm/nvidia/tegra_pcie.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (36 lines):

diff -r a257eaa7571a -r 33f017485bcd sys/arch/arm/nvidia/tegra_pcie.c
--- a/sys/arch/arm/nvidia/tegra_pcie.c  Fri Nov 13 18:52:16 2015 +0000
+++ b/sys/arch/arm/nvidia/tegra_pcie.c  Fri Nov 13 18:58:17 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_pcie.c,v 1.6 2015/11/13 18:52:16 jakllsch Exp $ */
+/* $NetBSD: tegra_pcie.c,v 1.7 2015/11/13 18:58:17 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #include "locators.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tegra_pcie.c,v 1.6 2015/11/13 18:52:16 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_pcie.c,v 1.7 2015/11/13 18:58:17 jakllsch Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -334,6 +334,8 @@
                reg = d * 0x1000 + offset;
                bsh = sc->sc_bsh_a1;
        } else {
+               if ((unsigned int)offset >= PCI_CONF_SIZE)
+                       return (pcireg_t) -1;
                reg = tag | offset;
                bsh = sc->sc_bsh_a2;
        }
@@ -360,6 +362,8 @@
                reg = d * 0x1000 + offset;
                bsh = sc->sc_bsh_a1;
        } else {
+               if ((unsigned int)offset >= PCI_CONF_SIZE)
+                       return;
                reg = tag | offset;
                bsh = sc->sc_bsh_a2;
        }



Home | Main Index | Thread Index | Old Index