Commit Graph
9613 Commits
Author SHA1 Message Date
Dan Williams b422bd58ef Merge request !1507 from 'CVE-2026-95622-new'
CVE-2026-95622: cbm: don't assert handling unsupported encodings (8-bit and reserved)

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1507
2026-10-04 08:52:00 -05:00
Dan Williams ee761d009d CVE-2026-95622: cbm: don't assert handling unsupported encodings (8-bit and reserved)
A cell broadcast message using unsupported encodings would trigger an
assert in ModemManager and kill the process. A compromised base station
or modem firmware could craft or pass through these messages.

Reported by Yehia Ezzat and Keith Linneman

Impact: Moderate
CVSS:3.1/AV:A/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H (6.5 Medium)
CWE-617 (Reachable Assertion)

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2026-10-04 08:52:02 -05:00
Dan Williams faa5642962 Merge request !1508 from 'qmi-add-pre-alerting'
broadband-modem-qmi: handle new QMI_VOICE_CALL_STATE_PRE_ALERTING

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1508
2026-10-04 08:48:38 -05:00
Dan Williams ac03e70426 broadband-modem-qmi: handle new QMI_VOICE_CALL_STATE_PRE_ALERTING
From https://gitlab.freedesktop.org/mobile-broadband/libqmi/-/merge_requests/477

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2026-10-04 08:47:30 -05:00
Dan Williams 338ecc06f2 Merge request !1484 from 'service-killmode-mixed'
service: don't SIGTERM the QMI/MBIM proxies together with the daemon

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1484
2026-09-22 12:34:34 -05:00
Semyon Maryasin 225e66fea9 service: don't SIGTERM the QMI/MBIM proxies together with the daemon
The qmi-proxy/mbim-proxy processes spawned by the daemon live in the
service's cgroup, so with the default KillMode=control-group systemd
sends SIGTERM to them at the same time as to the daemon on every unit
stop. The proxy exits immediately, tearing the control channel from
under the daemon while it is still disabling the modems:

    <msg> caught signal, shutting down...
    <msg> [modem0] state changed (connected -> disabling)
    <msg> [modem0] port 'cdc-wdm0' no longer controllable, reprobing
    <wrn> [/dev/cdc-wdm0] MBIM error: Device must be open to send commands
    <wrn> shutdown failed: timeout waiting for sleep preparation to complete

The consequences of losing the proxy mid-shutdown:
 - the modem disable/disconnect never reaches the device, so an MBIM
   session with an active bearer is left open in the firmware (observed
   to occasionally wedge the MBIM function of a Sierra EM7565 until a
   firmware reset);
 - the port teardown stalls waiting on the dead proxy until the
   shutdown timeout, so stopping the unit always takes the full
   MAX_SHUTDOWN_TIME_SECS instead of a second or two;
 - the port invalidation triggers the device reprobe path in the middle
   of the shutdown.

With KillMode=mixed only the daemon receives SIGTERM; the proxies
survive long enough for a clean disconnect and MBIM/QMI close, and
whatever remains in the cgroup afterwards (an idle, stateless proxy) is
killed when the unit finally stops.

Signed-off-by: Semyon Maryasin <simeon@maryasin.name>
2026-09-22 12:31:25 -05:00
Dan Williams efb6a9833e Merge request !1495 from 'fix-cancellation'
bearer-mbim: fix cancellation when waiting for async SLAAC

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1495
2026-09-20 15:52:15 -05:00
Aleksander Morgado 07893109ea bearer-mbim: avoid deadlock when cancelling async SLAAC logic
g_cancellable_disconnect() must not be called from within the
cancellable callback, or it will deadlock.

Signed-off-by: Aleksander Morgado <aleksandermj@google.com>
2026-09-20 15:49:48 -05:00
Aleksander Morgado 0082587915 bearer-mbim: fix cancellation when waiting for async SLAAC
The first argument in the GCallback is actually the GCancellable.

  0x00005cf40027c2d3 (ModemManager - mm-bearer-mbim.c: 643)	ip_configuration_async_cleanup
  0x00005cf40027bfb9 (ModemManager - mm-bearer-mbim.c: 671)	ip_configuration_async_cancelled
  0x00007feda3a6fb33 (libgobject-2.0.so.0 - gclosure.c: 895)	_g_closure_invoke_va
  0x00007feda3a87da1 (libgobject-2.0.so.0 - gsignal.c: 3472)	g_signal_emit_valist
  0x00007feda3a88811 (libgobject-2.0.so.0 - gsignal.c: 3622)	g_signal_emit
  0x00007feda3b0f98d (libgio-2.0.so.0 - gcancellable.c: 519)	g_cancellable_cancel
  0x00005cf4001dd8fa (ModemManager - mm-base-bearer.c)	modem_3gpp_registration_state_changed
  0x00007feda3a6f8d2 (libgobject-2.0.so.0 - gclosure.c: 832)	g_closure_invoke
  0x00007feda3a8728a (libgobject-2.0.so.0 - gsignal.c: 3812)	signal_emit_unlocked_R
  0x00007feda3a883d4 (libgobject-2.0.so.0 - gsignal.c: 3565)	g_signal_emit_valist
  0x00007feda3a88811 (libgobject-2.0.so.0 - gsignal.c: 3622)	g_signal_emit
  0x00007feda3a7aac2 (libgobject-2.0.so.0 - gobject.c: 1428)	g_object_dispatch_properties_changed
  0x00007feda3a757b8 (libgobject-2.0.so.0 - gobject.c: 359)	g_object_notify_queue_thaw
  0x00007feda3a773a9 (libgobject-2.0.so.0 - gobject.c: 2793)	g_object_set_valist
  0x00007feda3a77db8 (libgobject-2.0.so.0 - gobject.c: 2957)	g_object_set
  0x00005cf40021492a (ModemManager - mm-iface-modem-3gpp.c: 2347)	update_non_registered_state

Signed-off-by: Aleksander Morgado <aleksandermj@google.com>
2026-09-20 15:49:48 -05:00
Dan Williams b2017e5fd1 Merge request !1433 from 'id-mm-max-timeouts'
base-modem: make max timeouts configurable via udev rule

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1433
2026-09-20 15:49:17 -05:00
Filip Pokryvka 30e4577b4d base-modem: make max timeouts configurable via udev rule
Add the ID_MM_MAX_TIMEOUTS udev tag to allow users and system
administrators to configure the maximum number of consecutive
command timeouts before a modem is invalidated and re-probed,
on a per-device basis.

The tag accepts an integer value >= 0, where 0 disables the
timeout monitoring feature entirely. If not set, the existing
default of 10 consecutive timeouts is used.

This is needed for some older modems which become unresponsive
during consecutive data traffic, but come back alive when traffic
is lower. These modems have no further firmware updates available.

This follows the same pattern as other udev-configurable device
properties like ID_MM_MAX_MULTIPLEXED_LINKS.

Signed-off-by: Filip Pokryvka <fpokryvk@redhat.com>
2026-09-20 15:46:50 -05:00
Dan Williams e1f8061541 Merge request !1428 from 'fp/sierra_pco_disable'
Disable PCO on older Sierra modem MC7304

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1428
2026-09-08 12:03:26 -05:00
Filip Pokryvka 69cde63231 Disable PCO on older Sierra modem MC7304
Modem MC7304 has firmware flaw that PCO querry makes it unresponsive (firmware is not upgradable, no new release). There are possibily other older modems affected as well, I have no possibility to check. Add udev rule disabling PCO for affected modem (shares productID with RC7611).

Signed-off-by: Filip Pokryvka <fpokryvk@redhat.com>
2026-09-08 11:59:35 -05:00
Dan Williams 357130472d Merge request !1480 from 'creg_urc'
modem-helpers: fix multiple C*REG events in single URC

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1480

Closes #1087
2026-09-08 11:55:08 -05:00
Dominique Martinet 5e12f3fab5 tests: modem-helpers: test parsing multiple creg
The test_creg_match helper would only parse the first match, but actual
code e.g. parse_unsolicited() in src/mm-port-serial-at.c iterates over
all matches:
this updates the test to loop similarily to what is done in real code.

There were two tests assuming only the first match gets matched, so
their result were updated, and a third test was added matching the URC
received from a SIM7672 modem (including unrelated CNSMOD message)

Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
2026-09-08 18:52:03 +02:00
Dominique Martinet 04c9797456 modem-helpers: fix multiple C*REG events in single URC
When receiving a message from modem containing multiple CREG events that
have different format, the parsing happens in the order CREG regexes are
registered, and not in the order the modem sent the events.

That means that when receiving the following URC:
<CR><LF>+CEREG:  2<CR><LF><CR><LF>+CNSMOD: 8<CR><LF><CR><LF>+CEREG: 1,AAAA,01234567,7<CR><LF>
we'd incorrectly parse the `CEREG: 1` before `CEREG: 2`, and remember
the state as searching (2) instead of home (1), which can cause trouble
connecting because of waiting for state to go home which would never
happen again.

This fixes that problem by merging all the regexes together, so the
parsing should properly process the events in matching order in
parse_unsolicited()

Unfortunately changing the regex like this means that
mm_3gpp_parse_creg_response() match info handling also needs to be
reworked: matches number are increased for each regex, so we can
reliably know which regex was matched based on match count.
This is actually cleaner than the old approach that just guessed if nth
field with "item_is_lac_not_stat()", but requires careful testing.

This was validated checking that tests fail if any of the indices is
changed by iterating over them all and running the test:
grep -n 'n_matches -' src/mm-modem-helpers.c | sed -e 's/:.*//' \
	| while read lineno; do
		echo $lineno
		git show HEAD:src/mm-modem-helpers.c \
			| awk -v l=$lineno '{ if (NR == l) {
					print $1,$2,$3,$4,$5 - 1,";"
				} else {
					print
			}}' > src/mm-modem-helpers.c
		ninja -C build src/tests/test-modem-helpers || break
		build/src/tests/test-modem-helpers && break
	done

A test case was added to make this work, as the Samsung Wave S8500
sample 'act' doesn't seem to actually be a technology value?

(case 36/42 could actually be merged but were kept separate on purpose
for easier maintenance/testing)

Fixes: #1087
Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
2026-09-08 18:51:58 +02:00
Dan Williams 76c66944cc Merge request !1483 from 'patch-iccid-len'
Support ICCID length of 18 to 22

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1483
2026-09-04 22:57:34 -05:00
Semyon Maryasin 8d186a8df9 Support ICCID length of 18 to 22
Signed-off-by: Semyon Maryasin <simeon@maryasin.name>
2026-09-04 22:46:49 -05:00
Dan Williams b12f3bee54 Merge request !1490 from 'test-multipart-sms-pdu-type'
test-sms-list: test multipart concatenation differentiating by PDU type

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1490
2026-09-04 22:45:24 -05:00
Dan Williams 4449f2bc42 test-sms-list: test multipart concatenation differentiating by PDU type
Test the fix in MR !1469 that fixes the issue in #840.

If a multi-part PDU is sent from a device to its own number, on receipt
the DELIVER PDU was incorrectly dropped because when comparing the new
parts to existing ones, the comparison found the original SUBMIT PDU.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2026-09-04 22:46:09 -05:00
Dan Williams 23a87628e9 Merge request !1469 from 'multipart-sms'
broadband-modem: Fix receiving multipart SMS from own number

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1469
2026-09-04 21:37:31 -05:00
Christian Wendt ef88093931 broadband-modem: Fix receiving multipart SMS from own number
Signed-off-by: Christian Wendt <cw@brainaid.dk>
2026-08-31 08:30:13 +02:00
Dan Williams 5e91dd20c0 Merge request !1479 from 'modemmanager-coredump3'
qmi-shared: fix crash when passing a wrong log object

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1479
2026-08-30 10:16:27 -05:00
shuihan-001 efe507c240 qmi-shared: fix crash when passing a wrong log object
The patch resolves a coredump caused by using 'client' instead of 'self'
in mm_obj_warn() call when failing to register tracking events.

Signed-off-by: shuihan-001 <xing1989093@outlook.com>
2026-08-30 10:13:59 -05:00
Dan Williams c920ea6592 Merge request !1482 from 'patch-1'
Sierra Wireless EM7305: support ICCID response without !

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1482
2026-08-30 09:58:15 -05:00
Семён Марьясин a879fb717f Sierra Wireless EM7305: support ICCID response without !
On my modem, AT!ICCID? command gives response without a preceding `!`:

```
AT!ICCID?
ICCID: 8970162010103256136

OK
```

Signed-off-by: Semyon Maryasin <simeon@maryasin.name>
2026-08-30 09:54:17 -05:00
Dan Williams dc16f48f41 Merge request !1481 from 'caps-custom-data-class-str-init'
broadband-modem-mbim: initialize autofreed string to NULL

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1481

Closes #1094
2026-08-30 09:53:58 -05:00
Semyon Maryasin 6a14658a42 broadband-modem-mbim: initialize autofreed string to NULL
device_caps_query_ready() declares caps_custom_data_class_str as
g_autofree without an initializer. On every early error return
(command failure such as a transaction timeout or NotOpened, or a
response parse failure) the variable is never assigned, so the
autofree cleanup runs g_free() on uninitialized stack garbage,
crashing ModemManager with a glibc "invalid free" abort (or SIGSEGV)
whenever the device caps query fails during modem initialization.

Fixes: 19c817cfe9 ("broadband-modem-mbim: consistently handle custom data classes")
Closes: #1094

Signed-off-by: Semyon Maryasin <simeon@maryasin.name>
2026-08-30 09:49:13 -05:00
Dan Williams 53a9ad1aa2 Merge request !1477 from 'dp/libqcdm-write-fix'
libqcdm,tests: fix qcdm_send method for wwan

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1477
2026-08-29 23:32:50 -05:00
Daniele Palmas a838d3b98f libqcdm,tests: fix qcdm_send method for wwan
The qcdm wwan device does not cope well with writing single bytes,
while it does not have any issue if longer chunks are written.

Fix qcdm_send accordingly, since it should not hurt the previously
supported devices.

Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
2026-08-29 23:29:38 -05:00
Dan Williams cc29b5dac2 Merge request !1489 from 'deprecated-meson-option'
build: add -Ddeprecated=[true|false] to control deprecated symbols

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1489
2026-08-29 23:29:11 -05:00
Dan Williams abf9babb02 build: add -Ddeprecated=[true|false] to control deprecated symbols
Instead of using CFLAGS="-DMM_DISABLE_DEPRECATED" meson ...
which doesn't handle -Werror very well let's make it an explicit
option. Defaults to true, and autodetects previous CFLAGS
mechanism to preserve backwards compatibility.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2026-08-29 23:29:13 -05:00
Dan Williams 306f6256f8 Merge request !1476 from 'altair-lte-216f-0041'
altair: add ALT3100 USB product ID

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1476
2026-08-17 08:27:28 -05:00
Nikolay Savchenko d446e495eb altair: add ALT3100 USB product ID
Signed-off-by: Nikolay Savchenko <n.savchenko@axioma.lv>
2026-08-03 02:13:16 +03:00
Aleksander Morgado 9a2d5863eb Merge request !1455 from 'fix/inject-assistance-typo'
mm-shared-qmi: fix error message for xtra data injection timeout

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1455
2026-07-21 12:05:19 +02:00
Andrey Skvortsov 893ca6bdb0 mm-shared-qmi: fix error message for xtra data injection timeout
Most likely it was copied from set supl server code.

Signed-off-by: Andrey Skortsov <andrej.skvortzov@gmail.com>
2026-07-21 12:02:41 +02:00
Aleksander Morgado de4306bfda Merge request !1471 from 'aleksander/small-fixes'
libqcdm: minor fix in comment formatting

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1471
2026-07-20 20:19:15 +02:00
Aleksander Morgado 07146dfdfd libqcdm: minor fix in comment formatting
Signed-off-by: Aleksander Morgado <aleksandermj@google.com>
2026-07-20 18:07:20 +00:00
Aleksander Morgado 3568fb91a8 Merge request !1468 from 'aleksander/vreports3'
cinterion: fix heap double-free during GPS location disablement

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1468
2026-07-13 13:33:37 +02:00
Aleksander Morgado 5bb7ece8b4 cinterion: fix heap double-free during GPS location disablement
https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/work_items/1077

Signed-off-by: Aleksander Morgado <aleksandermj@google.com>
2026-07-13 11:22:25 +00:00
Aleksander Morgado 8b77e71298 Merge request !1466 from 'aleksander/qcdm-vreports'
QCDM OOB read fixes

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1466
2026-07-13 11:25:58 +02:00
Aleksander Morgado 96cb590724 libqcdm: fix heap out-of-bounds read in qcdm_log_item_evdo_pilot_sets_v2_new
Validate the active, candidate, and remaining count fields in
qcdm_log_item_evdo_pilot_sets_v2_new() before parsing the sets.
Ensure the received buffer is large enough to contain the number of
sets claimed by the counts.

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/work_items/1070

Signed-off-by: Aleksander Morgado <aleksandermj@google.com>
2026-07-13 10:59:28 +02:00
Aleksander Morgado e9932bde9d libqcdm: fix heap out-of-bounds read in qcdm_cmd_pilot_sets_result
Validate the active, candidate, and neighbor count fields in
qcdm_cmd_pilot_sets_result() before parsing the sets.

Ensure that the sum of counts does not exceed the size of the static
sets array in the response structure, and that the calculated size
based on the counts fits within the received buffer len.

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/work_items/1069

Signed-off-by: Aleksander Morgado <aleksandermj@google.com>
2026-07-13 10:59:28 +02:00
Aleksander Morgado 76ca77a897 Merge request !1465 from 'aleksander/vreports2'
Various use-after-free fixes

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1465
2026-07-10 15:02:49 +02:00
Aleksander Morgado 9642ed9ab5 ublox: fix UAF in custom init ready URC handler
Clear the unsolicited message handler in ready_received() before
completing the task. Otherwise, if the modem sends subsequent READY
URCs, the handler would fire again using the freed GTask pointer.

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/work_items/1074

Signed-off-by: Aleksander Morgado <aleksandermj@google.com>
2026-07-10 15:00:07 +02:00
Aleksander Morgado db72a182c1 port-serial-at: fix crash if URC handler is cleared mid-dispatch
Update parse_unsolicited() to re-check handler->callback on each
iteration of the match dispatch loop. If a URC handler callback clears
itself during dispatch (e.g. to stop listening), subsequent matches in
the same buffer would attempt to call the NULL pointer, causing a crash.

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/work_items/1074

Signed-off-by: Aleksander Morgado <aleksandermj@google.com>
2026-07-10 15:00:07 +02:00
Aleksander Morgado c3e7ffaae0 plugins: fix GError double-frees when returning errors from tasks
Use g_steal_pointer() when passing g_autoptr(GError) to
g_task_return_error() to prevent double-free by the automatic cleanup.

GTask takes ownership of the passed GError. If we use g_autoptr(GError)
locally, it will also call g_error_free() when the function returns,
causing a double-free / heap corruption. Stealing the pointer clears the
local variable and prevents the automatic cleanup.

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/work_items/1073

Signed-off-by: Aleksander Morgado <aleksandermj@google.com>
2026-07-10 15:00:07 +02:00
Aleksander Morgado 166d6c5bc8 quectel: fix UAF in RDY URC handler
Defer the validity change (which triggers modem reprobe/removal) to an
idle callback in rdy_handler().

Calling mm_base_modem_set_valid(FALSE) synchronously from the URC
handler triggers the immediate destruction of the modem object while the
serial port is still iterating the unsolicited message handlers. Deferring
the operation to an idle callback and taking a reference to the modem
ensures the modem object is kept alive until parse_unsolicited() has
returned.

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/work_items/1072

Signed-off-by: Aleksander Morgado <aleksandermj@google.com>
2026-07-10 15:00:07 +02:00
Aleksander Morgado 46a91399ca shared-qmi: fix UAF on duplicate list-configs indications
Disconnect the 'list-configs' indication handler immediately inside the
callback. If the modem sends a duplicate indication before the whole
config load sequence completes, it could overwrite the stored
'get-config-info' signal handler ID, orphaning the old handler and
leading to a Use-After-Free when the GTask is completed and the
orphaned handler eventually fires.

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/work_items/1071

Signed-off-by: Aleksander Morgado <aleksandermj@google.com>
2026-07-10 15:00:07 +02:00
Aleksander Morgado 2b1aaca4a0 ifaces: fix UAFs in signal handlers when hot-unplugging
Use g_signal_connect_object() to connect to child list/object signals
in the 3GPP, Messaging, Voice, and Cell Broadcast interfaces.

Passing the raw D-Bus skeleton pointer as user_data to these signals
can lead to a Use-After-Free if the skeleton is disposed of (e.g. on
hot-unplug) while the parent object or child list survives. By using
g_signal_connect_object(), the signal handlers are automatically
disconnected when the D-Bus skeleton is destroyed.

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/work_items/1068

Signed-off-by: Aleksander Morgado <aleksandermj@google.com>
2026-07-10 15:00:07 +02:00