udevng: Don't crash for non-QMI devices
PATCH 1/2 udevng: Don't crash for non-QMI devices
In cases where the modem detected isn't QMI, do not crash when trying to print the qmi devnode.
ofonod[278551]: Aborting (signal 11) [src/ofonod]
ofonod[278551]: ++++++++ backtrace ++++++++
ofonod[278551]: #0 0x7a779c5cbe20 in /usr/lib/libc.so.6 ofonod[278551]: #1 0x413470 in setup_sierra() at plugins/udevng.c:497 ofonod[278551]: #2 0x410a67 in create_modem() at plugins/udevng.c:2557 ofonod[278551]: #3 0x7a779c80b551 in /usr/lib/libglib-2.0.so.0 ofonod[278551]: #4 0x41955f in check_modem_list() at plugins/udevng.c:2626 ofonod[278551]: #5 0x7a779c81f43e in /usr/lib/libglib-2.0.so.0 ofonod[278551]: #6 0x7a779c81e199 in /usr/lib/libglib-2.0.so.0 ofonod[278551]: #7 0x7a779c87d3bf in /usr/lib/libglib-2.0.so.0 ofonod[278551]: #8 0x7a779c81edc7 in /usr/lib/libglib-2.0.so.0 ofonod[278551]: #9 0x5291e6 in main() at src/main.c:316 ofonod[278551]: #10 0x7a779c5b4d4a in /usr/lib/libc.so.6 ofonod[278551]: #11 0x7a779c5b4e0c in /usr/lib/libc.so.6 ofonod[278551]: +++++++++++++++++++++++++++ --- plugins/udevng.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
plugins/udevng.c +3 -2
@@ -495,7 +495,8 @@ static gboolean setup_sierra(struct modem_info *modem) get_ifname(net)); done:DBG ("modem=%s app=%s net=%s diag=%s qmi=%s" , - mdm, app,get_ifname (net), diag, qmi->devnode); + mdm, app,get_ifname (net), diag, + qmi ? qmi->devnode :NULL );ofono_modem_set_string (modem->modem,"Modem" , mdm);ofono_modem_set_string (modem->modem,"App" , app);
@@ -574,7 +575,7 @@ static gboolean setup_huawei(struct modem_info *modem) get_ifname(net)); done:DBG ("mdm=%s pcui=%s diag=%s qmi=%s net=%s" , - mdm, pcui, diag, qmi->devnode,get_ifname (net)); + mdm, pcui, diag, qmi ? qmi->devnode :NULL ,get_ifname (net));ofono_modem_set_string (modem->modem,"Modem" , mdm);ofono_modem_set_string (modem->modem,"Pcui" , pcui);
Signature · 1 line
2.45.0
PATCH 2/2 udevng: Fix detection of USB attached tty devices
devices on the USB bus, that are part of the tty subsystem were not forwarded to check_usb_device.
--- plugins/udevng.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
plugins/udevng.c +7 -8
@@ -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);
Signature · 1 line
2.45.0
Re: [PATCH 2/2] udevng: Fix detection of USB attached tty devices
Hi,
Quoted 21 lines · Denis Kenzior
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 <[email protected]>--- plugins/udevng.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)plugins/udevng.c +0
-4@@ -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);
plugins/udevng.c static void check_device(struct udev_device *device) · line 2523
Quoted 10 lines
plugins/udevng.c +3
-4-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.
plugins/udevng.c static void check_device(struct udev_device *device) · line 2525
Quoted 8 lines
plugins/udevng.c +4
-0+/* 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
Re: [PATCH 2/2] udevng: Fix detection of USB attached tty devices
Hi Ivo,
Quoted 9 lines
Quoted 7 lines
-
+ /* Handle USB-connected devices incheck_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
Ivaylo Dimitrov
Tested-byRe: [PATCH 2/2] udevng: Fix detection of USB attached tty devices
Hi Denis,
Quoted 10 lines · Denis Kenzior
Hi Ivo,
Quoted 8 lines
Quoted 7 lines
-
+ /* Handle USB-connected devices incheck_usb_device*/ + if (l_streq0(bus, "usb")) {
+check_usb_device(device);
return;
}
- if (l_streq0(subsystem, "usb")||l_streq0(subsystem, "usbmisc"))
Quoted 9 lines
Quoted 1 line
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_BUSto '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:
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.
This series was applied to ofono.git (master) by Denis Kenzior <[email protected]>:
Hello:
This series was applied to ofono.git (master)
by Denis Kenzior <[email protected]>:
Quoted 15 lines · On Thu, 30 May 2024 10:25:02 -0500 you wrote:
In cases where the modem detected isn't QMI, do not crash when trying to print the qmi devnode.
ofonod[278551]: Aborting (signal 11) [src/ofonod]
ofonod[278551]: ++++++++ backtrace ++++++++ofonod[278551]: #0 0x7a779c5cbe20 in /usr/lib/libc.so.6 ofonod[278551]: #1 0x413470 in setup_sierra() at plugins/udevng.c:497 ofonod[278551]: #2 0x410a67 in create_modem() at plugins/udevng.c:2557 ofonod[278551]: #3 0x7a779c80b551 in /usr/lib/libglib-2.0.so.0 ofonod[278551]: #4 0x41955f in check_modem_list() at plugins/udevng.c:2626 ofonod[278551]: #5 0x7a779c81f43e in /usr/lib/libglib-2.0.so.0 ofonod[278551]: #6 0x7a779c81e199 in /usr/lib/libglib-2.0.so.0 ofonod[278551]: #7 0x7a779c87d3bf in /usr/lib/libglib-2.0.so.0 ofonod[278551]: #8 0x7a779c81edc7 in /usr/lib/libglib-2.0.so.0 ofonod[278551]: #9 0x5291e6 in main() at src/main.c:316
Quoted 5 lines
ofonod[278551]: #10
0x7a779c5b4d4ain/usr/lib/libc.so.6ofonod[278551]: #110x7a779c5b4e0cin/usr/lib/libc.so.6ofonod[278551]: +++++++++++++++++++++++++++[...]
Here is the summary with links:
- [1/2] udevng: Don't crash for non-QMI devices
https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=d5daaeda9d19 - [2/2] udevng: Fix detection of USB attached tty devices https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=ddb637fb784a
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html