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 validate emulated bus 0 configuration sp...



details:   https://anonhg.NetBSD.org/src/rev/a257eaa7571a
branches:  trunk
changeset: 341614:a257eaa7571a
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Fri Nov 13 18:52:16 2015 +0000

description:
validate emulated bus 0 configuration space access more carefully

diffstat:

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

diffs (36 lines):

diff -r d757669a68e9 -r a257eaa7571a sys/arch/arm/nvidia/tegra_pcie.c
--- a/sys/arch/arm/nvidia/tegra_pcie.c  Fri Nov 13 18:23:17 2015 +0000
+++ b/sys/arch/arm/nvidia/tegra_pcie.c  Fri Nov 13 18:52:16 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_pcie.c,v 1.5 2015/11/13 18:23:17 jakllsch Exp $ */
+/* $NetBSD: tegra_pcie.c,v 1.6 2015/11/13 18:52:16 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.5 2015/11/13 18:23:17 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_pcie.c,v 1.6 2015/11/13 18:52:16 jakllsch Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -329,6 +329,8 @@
        tegra_pcie_decompose_tag(v, tag, &b, &d, &f);
 
        if (b == 0) {
+               if (d >= 2 || f != 0)
+                       return (pcireg_t) -1;
                reg = d * 0x1000 + offset;
                bsh = sc->sc_bsh_a1;
        } else {
@@ -353,6 +355,8 @@
        tegra_pcie_decompose_tag(v, tag, &b, &d, &f);
 
        if (b == 0) {
+               if (d >= 2 || f != 0)
+                       return;
                reg = d * 0x1000 + offset;
                bsh = sc->sc_bsh_a1;
        } else {



Home | Main Index | Thread Index | Old Index