From: Michal Privoznik Date: Mon, 31 May 2021 14:42:13 +0000 (+0200) Subject: node_device_udev: Also process ID_TYPE=cd/dvd in udevProcessStorage() X-Git-Tag: v7.5.0-rc1~220 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e76ec0fe65d83f4947136ff9a0a87f03c94d82e2;p=thirdparty%2Flibvirt.git node_device_udev: Also process ID_TYPE=cd/dvd in udevProcessStorage() When processing node devices, the udevProcessStorage() will be called if the device is some form of storage. In here, ID_TYPE attribute is queried and depending on its value one of more specialized helper functions is called. For instance, for ID_TYPE=="cd" the udevProcessCDROM() is called, for ID_TYPE=="disk" the udevProcessDisk() is called, and so on. But there's a problem with ID_TYPE and its values. Coming from udev, we are not guaranteed that ID_TYPE will contain "cd" for CDROM devices. In fact, there's a rule installed by sg3_utils that will overwrite ID_TYPE to "cd/dvd" leaving us with an unhandled type. Fortunately, this was fixed in their upstream, but there are still versions out there, on OS platforms that we aim to support that contain the problematic rule. Therefore, we should accept both strings. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1848875 Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c index a43e06c231..f99578414d 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -971,7 +971,8 @@ udevProcessStorage(struct udev_device *device, goto cleanup; } - if (STREQ(def->caps->data.storage.drive_type, "cd")) { + if (STREQ(def->caps->data.storage.drive_type, "cd") || + STREQ(def->caps->data.storage.drive_type, "cd/dvd")) { rv = udevProcessCDROM(device, def); } else if (STREQ(def->caps->data.storage.drive_type, "disk")) { rv = udevProcessDisk(device, def);