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 <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Michal Privoznik 2021-05-31 16:42:13 +02:00
parent 791b1173d0
commit e76ec0fe65

View File

@ -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);