Message ID | 20240530152513.279243-2-denkenz@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | ddb637fb784af76f08d884ceee5e894fec1a684b |
Headers | show |
Series | [1/2] udevng: Don't crash for non-QMI devices | expand |
Hi, On 30.05.24 г. 18:25 ч., Denis Kenzior wrote: > devices on the USB bus, that are part of the tty subsystem were not > forwarded to check_usb_device. > > Fixes: cdd58360140a ("udevng: Add mhi subsystem detection") > Reported-By: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> > --- > plugins/udevng.c | 15 +++++++-------- > 1 file changed, 7 insertions(+), 8 deletions(-) > > diff --git a/plugins/udevng.c b/plugins/udevng.c > index 07c87eb8aa08..87969461ac5b 100644 > --- a/plugins/udevng.c > +++ b/plugins/udevng.c > @@ -2510,17 +2510,16 @@ static void check_device(struct udev_device *device) > const char *subsystem = udev_device_get_subsystem(device); > const char *bus = udev_device_get_property_value(device, "ID_BUS"); > > - if (l_streq0(subsystem, "net")) { > - /* Handle USB-connected network devices in check_usb_device */ > - if (l_streq0(bus, "usb")) > - check_usb_device(device); > - else > - check_net_device(device); > - > + /* Handle USB-connected devices in check_usb_device */ > + if (l_streq0(bus, "usb")) { > + check_usb_device(device); > return; > } > > - if (l_streq0(subsystem, "usb") || l_streq0(subsystem, "usbmisc")) Is it possible (in theory) that we have 'usb' subsystem device that is not on USB bus? If yes, then you shouldn't drop l_streq0(subsystem, "usb") check. > + /* Check the rest based on the subsystem */ > + if (l_streq0(subsystem, "net")) > + check_net_device(device); > + else if (l_streq0(subsystem, "usbmisc")) > check_usb_device(device); > else if (l_streq0(subsystem, "pci")) > check_pci_device(device); > Regards, Ivo
Hi Ivo, >> - >> + /* Handle USB-connected devices in check_usb_device */ >> + if (l_streq0(bus, "usb")) { >> + check_usb_device(device); >> return; >> } >> - if (l_streq0(subsystem, "usb") || l_streq0(subsystem, "usbmisc")) > > Is it possible (in theory) that we have 'usb' subsystem device that is not on > USB bus? If yes, then you shouldn't drop l_streq0(subsystem, "usb") check. I hope not. What i've seen is subsystem 'usbmisc' devices not setting ID_BUS to 'usb', which is a bit weird. Hence the 'usbmisc' check below. I think we do not care about usb subsystem devices, only the leafs: - usbmisc (cdc-acm) - tty (ttyUSB...) - net Regards, -Denis
Hi Denis, On 31.05.24 г. 18:52 ч., Denis Kenzior wrote: > Hi Ivo, > >>> - >>> + /* Handle USB-connected devices in check_usb_device */ >>> + if (l_streq0(bus, "usb")) { >>> + check_usb_device(device); >>> return; >>> } >>> - if (l_streq0(subsystem, "usb") || l_streq0(subsystem, "usbmisc")) >> >> Is it possible (in theory) that we have 'usb' subsystem device that is >> not on USB bus? If yes, then you shouldn't drop l_streq0(subsystem, >> "usb") check. > > I hope not. What i've seen is subsystem 'usbmisc' devices not setting > ID_BUS to 'usb', which is a bit weird. Hence the 'usbmisc' check below. > > I think we do not care about usb subsystem devices, only the leafs: > - usbmisc (cdc-acm) > - tty (ttyUSB...) > - net > I see. Well, the $subject patch is fixing my USB Quectel not being recognized, so in case tags are used, you can add my: Tested-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> Thanks and regards, Ivo P.S. It is not that I forgot about call forwarding API change, it is just that I was very busy with my RL job. Will implement it as soon as I have few spare days.
diff --git a/plugins/udevng.c b/plugins/udevng.c index 07c87eb8aa08..87969461ac5b 100644 --- a/plugins/udevng.c +++ b/plugins/udevng.c @@ -2510,17 +2510,16 @@ static void check_device(struct udev_device *device) const char *subsystem = udev_device_get_subsystem(device); const char *bus = udev_device_get_property_value(device, "ID_BUS"); - if (l_streq0(subsystem, "net")) { - /* Handle USB-connected network devices in check_usb_device */ - if (l_streq0(bus, "usb")) - check_usb_device(device); - else - check_net_device(device); - + /* Handle USB-connected devices in check_usb_device */ + if (l_streq0(bus, "usb")) { + check_usb_device(device); return; } - if (l_streq0(subsystem, "usb") || l_streq0(subsystem, "usbmisc")) + /* Check the rest based on the subsystem */ + if (l_streq0(subsystem, "net")) + check_net_device(device); + else if (l_streq0(subsystem, "usbmisc")) check_usb_device(device); else if (l_streq0(subsystem, "pci")) check_pci_device(device);