[systemd-commits] src/libudev src/udev

Kay Sievers kay at kemper.freedesktop.org
Thu Nov 15 08:33:27 PST 2012


 src/libudev/libudev-hwdb.c   |    2 +-
 src/udev/udev-builtin-hwdb.c |    3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 33c770b174ec77d7da6e7e830e0bca9f74d54367
Author: Kay Sievers <kay at vrfy.org>
Date:   Thu Nov 15 17:30:03 2012 +0100

    udev: hwdb - properly handle a missing database
    
    On Thu, Nov 15, 2012 at 5:05 PM, Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl> wrote:
    > Something like this appeared with latest git:
    >
    > Nov 15 16:55:46 fedora-15 systemd-udevd[334]: worker [364] terminated by signal 11 (Segmentation fault)
    > Nov 15 16:55:46 fedora-15 [387]: Process 364 (systemd-udevd) dumped core.
    > Nov 15 16:55:46 fedora-15 systemd-udevd[334]: worker [364] failed while handling '/devices/virtual/net/lo'
    > Nov 15 16:55:46 fedora-15 systemd-udevd[334]: worker [360] terminated by signal 11 (Segmentation fault)
    > Nov 15 16:55:46 fedora-15 systemd-udevd[334]: worker [360] failed while handling '/devices/pci0000:00/0000:00:03.0/virtio0/net
    > Nov 15 16:55:46 fedora-15 [389]: Process 360 (systemd-udevd) dumped core.
    >
    > Core was generated by usr/lib/systemd/systemd-udevd'.
    > Program terminated with signal 11, Segmentation fault.
    > #0  0x0000000000423c87 in udev_hwdb_get_properties_list_entry (hwdb=0x0, modalias=0x7fffbcd155f0

diff --git a/src/libudev/libudev-hwdb.c b/src/libudev/libudev-hwdb.c
index 751b342..6779e45 100644
--- a/src/libudev/libudev-hwdb.c
+++ b/src/libudev/libudev-hwdb.c
@@ -377,7 +377,7 @@ bool udev_hwdb_validate(struct udev_hwdb *hwdb) {
 _public_ struct udev_list_entry *udev_hwdb_get_properties_list_entry(struct udev_hwdb *hwdb, const char *modalias, unsigned int flags) {
         int err;
 
-        if (!hwdb->f) {
+        if (!hwdb || !hwdb->f) {
                 errno = EINVAL;
                 return NULL;
         }
diff --git a/src/udev/udev-builtin-hwdb.c b/src/udev/udev-builtin-hwdb.c
index 234448c..0b35d79 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 -ENOENT;
+
         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),



More information about the systemd-commits mailing list