Cinterion: Fix WS46 mode parsing for ELS62 modem and avoid double free#26
Open
ihasz wants to merge 2 commits intolinux-mobile-broadband:mainfrom
Open
Cinterion: Fix WS46 mode parsing for ELS62 modem and avoid double free#26ihasz wants to merge 2 commits intolinux-mobile-broadband:mainfrom
ihasz wants to merge 2 commits intolinux-mobile-broadband:mainfrom
Conversation
g_task_return_error() takes ownership of the GError, but the g_autoptr(GError) cleanup also frees it, causing a double free and crash when parsing fails. Fix by using g_steal_pointer(&error) when returning the error.
Some modems (e.g. Cinterion ELS62) report additional WS46 modes (29, 30, 31) which are currently treated as errors. Align behavior with Telit plugin by mapping these modes to appropriate MMModemMode bitmasks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
ModemManager crashes with certain Cinterion ELS62 modems when querying +WS46 mode.
The modem responds with +WS46: 30, which the current parser does not recognize, leading to an unhandled GError and a double free crash.
Observed on Debian stable 1.24.0 package (ModemManager 1.24.0-1+deb13u1).
Solution
Extend the switch in mm_cinterion_parse_ws46_response() to handle mode 30 properly.
Ensure that GError is handled safely to prevent double free in ws46_query_ready().
This brings Cinterion support in line with Telit parser logic, which handles all modes reported by AT+WS46=?:
+WS46: (12,22,25,28,29,30,31)
Testing
Tested on ELS62 modem, Debian 13, ModemManager 1.24.0 patched with this fix.
No crashes observed when querying WS46.
Verified the allowed modem modes are parsed correctly for mode 30.
Notes
Backwards compatible with existing modem types and other WS46 modes.
This patch only affects Cinterion WS46 parsing; other modem families remain unchanged.