Fix NULL pointer deference in udev_hwdb_get_properties_list_entry

It is possible for udev_hwdb_get_properties_list_entry to be invoked
during udevd initialization before hwdb has been initialized. We
workaround that for now by introducing a check to handle that.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Commit-message-by: Richard Yao <ryao@gentoo.org>
This commit is contained in:
Felipe Contreras 2012-11-19 11:03:52 +01:00 committed by Richard Yao
parent bcc69ef934
commit f74b77335b

View File

@ -33,6 +33,9 @@ int udev_builtin_hwdb_lookup(struct udev_device *dev, const char *modalias, bool
struct udev_list_entry *entry;
int n = 0;
if (!hwdb)
return EXIT_FAILURE;
udev_list_entry_foreach(entry, udev_hwdb_get_properties_list_entry(hwdb, modalias, 0)) {
if (udev_builtin_add_property(dev, test,
udev_list_entry_get_name(entry),