[coreboot] NULL pointer dereference in search_bus_device()

Sven Schnelle svens at stackframe.org
Mon Jan 10 13:59:02 CET 2011


Hi List,

during coreboot development i faced the problem that coreboot sometimes
hanged after printing the List of PCI devices. It turned out that this
is a NULL pointer dereference in search_bus_devices().

Not sure if the following patch is the correct fix, as i don't know
that part of the code well. If it is not, please discard the patch
and provide a better one :)

commit 11a840272dd5f0d0f1a8414163f5404fb028c209
Author: Sven Schnelle <svens at stackframe.org>
Date:   Mon Jan 10 13:53:18 2011 +0100

    Fix a NULL pointer dereference in search_bus_devices()
    
    Signed-off-by: Sven Schnelle <svens at stackframe.org>

diff --git a/src/devices/device_util.c b/src/devices/device_util.c
index 9081a36..d761cba 100644
--- a/src/devices/device_util.c
+++ b/src/devices/device_util.c
@@ -583,8 +583,9 @@ void search_bus_resources(struct bus *bus, unsigned long type_mask,
 					if (subbus->link_num
 					== IOINDEX_SUBTRACTIVE_LINK(res->index))
 						break;
-				search_bus_resources(subbus, type_mask, type,
-						     search, gp);
+				if (subbus)
+					search_bus_resources(subbus, type_mask, type,
+								search, gp);
 				continue;
 			}
 			search(gp, curdev, res);

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://www.coreboot.org/pipermail/coreboot/attachments/20110110/1716da04/attachment.sig>


More information about the coreboot mailing list