libmutipath: don't use malformed uevents
authorBenjamin Marzinski <bmarzins@redhat.com>
Tue, 9 Oct 2018 23:03:09 +0000 (18:03 -0500)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Wed, 10 Oct 2018 06:09:39 +0000 (08:09 +0200)
A uevent that doesn't include the ACTION and DEVPATH fields is
malformed. It should be ignored, instead of used with those fields being
NULL.

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
libmultipath/uevent.c

index fd8ca35..5f910e6 100644 (file)
@@ -729,6 +729,12 @@ struct uevent *uevent_from_udev_device(struct udev_device *dev)
                if (i == HOTPLUG_NUM_ENVP - 1)
                        break;
        }
+       if (!uev->devpath || ! uev->action) {
+               udev_device_unref(dev);
+               condlog(1, "uevent missing necessary fields");
+               FREE(uev);
+               return NULL;
+       }
        uev->udev = dev;
        uev->envp[i] = NULL;