From f4316f8c101b956af624b0c046c418b4489f6558 Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Mon, 7 Jul 2014 17:11:53 +0200 Subject: libpayload: Catch null-pointer dereference in xHCI Fix a possible null-pointer dereference (hopefully) before anyone runs into this. Also don't switch ports to xHCI if initialization failed. Change-Id: I5dbaeb435a98ead0b50d27fde13c9f1433ea3e81 Signed-off-by: Nico Huber Reviewed-on: http://review.coreboot.org/6245 Tested-by: build bot (Jenkins) Reviewed-by: Edward O'Callaghan Reviewed-by: Paul Menzel --- payloads/libpayload/drivers/usb/xhci.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/payloads/libpayload/drivers/usb/xhci.c b/payloads/libpayload/drivers/usb/xhci.c index 97c27bcd50..69ddab791a 100644 --- a/payloads/libpayload/drivers/usb/xhci.c +++ b/payloads/libpayload/drivers/usb/xhci.c @@ -312,9 +312,11 @@ xhci_pci_init (pcidev_t addr) } controller = xhci_init((unsigned long)reg_addr); - controller->pcidev = addr; + if (controller) { + controller->pcidev = addr; - xhci_switch_ppt_ports(addr); + xhci_switch_ppt_ports(addr); + } return controller; } -- cgit v1.2.3