diff options
author | Felipe Contreras <felipe.contreras@gmail.com> | 2012-11-19 11:03:52 +0100 |
---|---|---|
committer | Richard Yao <ryao@cs.stonybrook.edu> | 2012-11-20 17:18:01 -0500 |
commit | f74b77335b994d5dcecbc0d5d0d4bbfc8364c1b5 (patch) | |
tree | ce870083998f78c8a10935d07f2736eca738391a | |
parent | bcc69ef934c9d14732e16551032242fa599b44e7 (diff) |
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>
-rw-r--r-- | src/udev/udev-builtin-hwdb.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/udev/udev-builtin-hwdb.c b/src/udev/udev-builtin-hwdb.c index 234448cdf1..3004af0e1c 100644 --- a/src/udev/udev-builtin-hwdb.c +++ b/src/udev/udev-builtin-hwdb.c @@ -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), |