Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci Fix null deref for busses with no IO port resour...
details: https://anonhg.NetBSD.org/src/rev/b2096c5905ab
branches: trunk
changeset: 968967:b2096c5905ab
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sun Feb 02 14:45:14 2020 +0000
description:
Fix null deref for busses with no IO port resources.
diffstat:
sys/dev/pci/pciconf.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diffs (39 lines):
diff -r d7cafe09e1c4 -r b2096c5905ab sys/dev/pci/pciconf.c
--- a/sys/dev/pci/pciconf.c Sun Feb 02 09:19:48 2020 +0000
+++ b/sys/dev/pci/pciconf.c Sun Feb 02 14:45:14 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pciconf.c,v 1.45 2020/01/20 10:35:42 skrll Exp $ */
+/* $NetBSD: pciconf.c,v 1.46 2020/02/02 14:45:14 jmcneill Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pciconf.c,v 1.45 2020/01/20 10:35:42 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pciconf.c,v 1.46 2020/02/02 14:45:14 jmcneill Exp $");
#include "opt_pci.h"
@@ -772,6 +772,12 @@
continue;
pd = pi->dev;
+ if (pb->ioext == NULL) {
+ /* Bus has no IO ranges, disable IO BAR */
+ pi->address = 0;
+ pd->enable &= ~PCI_CONF_ENABLE_IO;
+ goto write_ioaddr;
+ }
pi->address = pci_allocate_range(pb->ioext, pi->size,
pi->align, false);
if (~pi->address == 0) {
@@ -798,6 +804,7 @@
} else {
pd->enable |= PCI_CONF_ENABLE_IO;
}
+write_ioaddr:
if (pci_conf_debug) {
print_tag(pd->pc, pd->tag);
printf("Putting %" PRIu64 " I/O bytes @ %#" PRIx64
Home |
Main Index |
Thread Index |
Old Index