Martin L Roth has submitted this change. ( https://review.coreboot.org/c/coreboot/+/75645?usp=email )
(
1 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: libpayload/drivers/usb/xhci.c: Check for NULL in xhci_init ......................................................................
libpayload/drivers/usb/xhci.c: Check for NULL in xhci_init
Ensure the physical_bar parameter passed to xhci_init is not NULL, else return NULL. This may occur when an XHCI controller is disabled and no resources are allocated for it.
BUG=b:284213001
Change-Id: I05c32612606793adcba3f4a5724092387a215d41 Signed-off-by: Fred Reitberger reitbergerfred@gmail.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/75645 Reviewed-by: Jon Murphy jpmurphy@google.com Reviewed-by: Karthik Ramasubramanian kramasub@google.com Reviewed-by: Martin L Roth gaumless@gmail.com Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M payloads/libpayload/drivers/usb/xhci.c 1 file changed, 4 insertions(+), 0 deletions(-)
Approvals: Jon Murphy: Looks good to me, approved Karthik Ramasubramanian: Looks good to me, approved build bot (Jenkins): Verified Martin L Roth: Looks good to me, approved
diff --git a/payloads/libpayload/drivers/usb/xhci.c b/payloads/libpayload/drivers/usb/xhci.c index 6737a14..e9a7ead 100644 --- a/payloads/libpayload/drivers/usb/xhci.c +++ b/payloads/libpayload/drivers/usb/xhci.c @@ -155,6 +155,9 @@ { int i;
+ if (!physical_bar) + goto _exit_xhci; + /* First, allocate and initialize static controller structures */
hci_t *const controller = new_controller(); @@ -301,6 +304,7 @@ /* _free_controller: */ detach_controller(controller); free(controller); +_exit_xhci: return NULL; }