filter: explicitly allow port when ID_MM_PLATFORM_DRIVER_PROBE is set

Don't assume that the port will be implicitly allowed afterwards.
This commit is contained in:
Aleksander Morgado
2017-10-16 22:00:39 +02:00
parent c4bf785d67
commit 5b3baa02d3

View File

@@ -100,10 +100,13 @@ mm_filter_port (MMFilter *self,
/* If the physdev is a 'platform' or 'pnp' device that's not whitelisted, ignore it */ /* If the physdev is a 'platform' or 'pnp' device that's not whitelisted, ignore it */
physdev_subsystem = mm_kernel_device_get_physdev_subsystem (port); physdev_subsystem = mm_kernel_device_get_physdev_subsystem (port);
if ((self->priv->enabled_rules & MM_FILTER_RULE_TTY_PLATFORM_DRIVER) && if ((self->priv->enabled_rules & MM_FILTER_RULE_TTY_PLATFORM_DRIVER) &&
(!g_strcmp0 (physdev_subsystem, "platform") || !g_strcmp0 (physdev_subsystem, "pnp")) && (!g_strcmp0 (physdev_subsystem, "platform") || !g_strcmp0 (physdev_subsystem, "pnp"))) {
(!mm_kernel_device_get_global_property_as_boolean (port, "ID_MM_PLATFORM_DRIVER_PROBE"))) { if (!mm_kernel_device_get_global_property_as_boolean (port, "ID_MM_PLATFORM_DRIVER_PROBE")) {
mm_dbg ("[filter] (%s/%s): port filtered: port's parent platform driver is not whitelisted", subsystem, name); mm_dbg ("[filter] (%s/%s): port filtered: port's parent platform driver is not whitelisted", subsystem, name);
return FALSE; return FALSE;
}
mm_dbg ("[filter] (%s/%s): port allowed: port's parent platform driver is whitelisted", subsystem, name);
return TRUE;
} }
/* Otherwise, TTY probed */ /* Otherwise, TTY probed */