1.20.4: Bad sim card causes MM crash when using Cinterion modem
Steps to reproduce:
- Insert sim card on which Internet connection does not work. Mine was disabled by the ISP;
- Try to enable modem using following command: mmcli -m 0 -e
- Observe crash of MM in logs
Hardware: Cinterion ELS62-E
Software: MM v1.20.4
Example of logs:
ModemManager[881]: <info> [1678807454.998931] [modem0] state changed (disabled -> enabling)
ModemManager[881]: <debug> [1678807454.999623] [ttyACM1/at] device open count is 2 (open)
ModemManager[881]: <debug> [1678807454.999745] [ttyACM2/at] opening serial port...
ModemManager[881]: <debug> [1678807455.000545] [ttyACM2/at] setting up baudrate: 57600
ModemManager[881]: <debug> [1678807455.000687] [ttyACM2/at] no flow control explicitly requested for device
ModemManager[881]: <debug> [1678807455.000828] [ttyACM2/at] device open count is 1 (open)
ModemManager[881]: <debug> [1678807455.000890] [modem0] flashing primary AT port before enabling...
ModemManager[881]: <debug> [1678807455.001060] [modem0] running initialization sequence...
ModemManager[881]: <debug> [1678807455.001230] [ttyACM1/at] device open count is 3 (open)
ModemManager[881]: <debug> [1678807455.001384] [ttyACM1/at] --> 'ATZ<CR>'
ModemManager[881]: <debug> [1678807455.045259] [ttyACM1/at] <-- '<CR><LF>OK<CR><LF>'
ModemManager[881]: <debug> [1678807455.045512] [modem0] giving some time to settle the modem...
ModemManager[881]: <debug> [1678807455.045581] [ttyACM1/at] device open count is 2 (close)
ModemManager[881]: <debug> [1678807455.546659] [ttyACM1/at] running init sequence...
ModemManager[881]: <debug> [1678807455.546882] [ttyACM2/at] running init sequence...
ModemManager[881]: <debug> [1678807455.547001] [modem0] loading power state...
ModemManager[881]: <debug> [1678807455.547068] [ttyACM1/at] device open count is 3 (open)
ModemManager[881]: <debug> [1678807455.547253] [ttyACM1/at] --> 'ATE0<CR>'
ModemManager[881]: <debug> [1678807455.547347] [ttyACM2/at] --> 'ATE0<CR>'
ModemManager[881]: <debug> [1678807455.552164] [ttyACM2/at] <-- 'ATE0'
ModemManager[881]: <debug> [1678807455.554528] [ttyACM1/at] <-- '<CR><LF>OK<CR><LF>'
ModemManager[881]: <debug> [1678807455.554791] [ttyACM2/at] <-- '<CR>'
ModemManager[881]: <debug> [1678807455.554958] [ttyACM2/at] <-- '<CR><LF>OK<CR><LF>'
ModemManager[881]: <debug> [1678807455.555148] [ttyACM1/at] --> 'ATV1<CR>'
ModemManager[881]: <debug> [1678807455.566649] [ttyACM1/at] <-- '<CR><LF>OK<CR><LF>'
ModemManager[881]: <debug> [1678807455.566926] [ttyACM1/at] --> 'AT+CMEE=1<CR>'
ModemManager[881]: <debug> [1678807455.583771] [ttyACM1/at] <-- '<CR><LF>OK<CR><LF>'
ModemManager[881]: <debug> [1678807455.584031] [ttyACM1/at] --> 'ATX4<CR>'
ModemManager[881]: <debug> [1678807455.605377] [ttyACM1/at] <-- '<CR><LF>OK<CR><LF>'
ModemManager[881]: <debug> [1678807455.605659] [ttyACM1/at] --> 'AT&C1<CR>'
ModemManager[881]: <debug> [1678807455.618494] [ttyACM1/at] <-- '<CR><LF>OK<CR><LF>'
ModemManager[881]: <debug> [1678807455.618773] [ttyACM1/at] --> 'AT+CFUN?<CR>'
ModemManager[881]: <debug> [1678807455.639427] [ttyACM1/at] <-- '<CR><LF>'
ModemManager[881]: <debug> [1678807455.639666] [ttyACM1/at] <-- '+CFUN: 1<CR><LF><CR><LF>OK<CR><LF>'
ModemManager[881]: <debug> [1678807455.639910] [modem0] no need to change power state: already 'on'
ModemManager[881]: <info> [1678807455.639977] [modem0] power state updated: on
ModemManager[881]: <debug> [1678807455.640082] [modem0] checking if SIM was swapped...
ModemManager[881]: <debug> [1678807455.640209] [modem0/sim0] loading SIM identifier...
ModemManager[881]: <debug> [1678807455.640284] [ttyACM1/at] device open count is 4 (open)
ModemManager[881]: <debug> [1678807455.640398] [ttyACM1/at] device open count is 3 (close)
ModemManager[881]: <debug> [1678807455.640523] [ttyACM1/at] --> 'AT+CRSM=176,12258,0,0,10<CR>'
ModemManager[881]: <debug> [1678807455.684020] [ttyACM1/at] <-- '<CR><LF>+CRSM: 144,0,"[removed]"<CR><LF>'
ModemManager[881]: <debug> [1678807455.684707] [ttyACM1/at] <-- '<CR><LF>OK<CR><LF>'
ModemManager[881]: <debug> [1678807455.685021] [modem0/sim0] loaded SIM identifier: [removed]
ModemManager[881]: <debug> [1678807455.685160] [modem0] SIM identifier has not changed
ModemManager[881]: <debug> [1678807455.685224] [modem0/sim0] loading IMSI...
ModemManager[881]: <debug> [1678807455.685326] [ttyACM1/at] device open count is 4 (open)
ModemManager[881]: <debug> [1678807455.685440] [ttyACM1/at] device open count is 3 (close)
ModemManager[881]: <debug> [1678807455.685556] [ttyACM1/at] --> 'AT+CIMI<CR>'
ModemManager[881]: <debug> [1678807455.711394] [ttyACM1/at] <-- '<CR><LF>[removed]<CR><LF>'
ModemManager[881]: <debug> [1678807455.712019] [ttyACM1/at] <-- '<CR><LF>OK<CR><LF>'
ModemManager[881]: <debug> [1678807455.712280] [modem0/sim0] loaded IMSI: [removed]
ModemManager[881]: <debug> [1678807455.712365] [modem0] SIM imsi has not changed
ModemManager[881]: <debug> [1678807455.712487] [ttyACM1/at] device open count is 4 (open)
ModemManager[881]: <debug> [1678807455.712598] [ttyACM1/at] device open count is 3 (close)
ModemManager[881]: <debug> [1678807455.712710] [ttyACM1/at] --> 'AT\Q3<CR>'
ModemManager[881]: <debug> [1678807455.734398] [ttyACM1/at] <-- '<CR><LF>OK<CR><LF>'
ModemManager[881]: <debug> [1678807455.734653] [modem0] modem has 3GPP capabilities, enabling the Modem 3GPP interface...
ModemManager[881]: <debug> [1678807455.734757] [modem0] checking indicator support...
ModemManager[881]: <debug> [1678807455.734829] [ttyACM1/at] device open count is 4 (open)
ModemManager[881]: <debug> [1678807455.734930] [ttyACM1/at] device open count is 3 (close)
ModemManager[881]: <debug> [1678807455.735037] [ttyACM1/at] --> 'AT+CIND=?<CR>'
ModemManager[881]: <debug> [1678807455.761676] [ttyACM1/at] <-- '<CR><LF>+CIND: ("service",(0-1))<CR><LF>'
ModemManager[881]: <debug> [1678807455.761953] [ttyACM1/at] <-- '<CR><LF>OK<CR><LF>'
ModemManager[881]: <debug> [1678807455.762217] [modem0] service indications via CIND are supported at index '1'
ModemManager[881]: <debug> [1678807455.762336] [ttyACM1/at] device open count is 4 (open)
ModemManager[881]: <debug> [1678807455.762429] [ttyACM1/at] device open count is 3 (close)
ModemManager[881]: <debug> [1678807455.762535] [ttyACM1/at] --> 'AT+CMER=?<CR>'
ModemManager[881]: <debug> [1678807455.788163] [ttyACM1/at] <-- '<CR><LF>ERROR<CR><LF>'
ModemManager[881]: <debug> [1678807455.788380] [ttyACM1/at] operation failure: 100 (Unknown error)
ModemManager[881]: <debug> [1678807455.788467] [modem0] +CMER check failed: Unknown error
ModemManager[881]: <debug> [1678807455.788514] [modem0] generic indications are unsupported
ModemManager[881]: <debug> [1678807455.788565] [modem0] checking packet domain event reporting...
ModemManager[881]: <debug> [1678807455.788648] [ttyACM1/at] device open count is 4 (open)
ModemManager[881]: <debug> [1678807455.788738] [ttyACM1/at] device open count is 3 (close)
ModemManager[881]: <debug> [1678807455.788841] [ttyACM1/at] --> 'AT+CGEREP=?<CR>'
ModemManager[881]: <debug> [1678807455.807328] [ttyACM1/at] <-- '<CR><LF>+CGEREP: (0-2),(0-1)<CR><LF>'
ModemManager[881]: <debug> [1678807455.807982] [ttyACM1/at] <-- '<CR><LF>OK<CR><LF>'
ModemManager[881]: <debug> [1678807455.808236] [modem0] packet domain event reporting is supported
ModemManager[881]: <debug> [1678807455.808354] [modem0] setting 3GPP +CIEV unsolicited events handlers in ttyACM1
ModemManager[881]: <debug> [1678807455.808417] [modem0] setting 3GPP +CIEV unsolicited events handlers in ttyACM2
ModemManager[881]: <debug> [1678807455.808490] [modem0] setting 3GPP +CGEV unsolicited events handlers in ttyACM1
ModemManager[881]: <debug> [1678807455.808548] [modem0] setting 3GPP +CGEV unsolicited events handlers in ttyACM2
ModemManager[881]: <debug> [1678807455.808661] [modem0] enabling +CGEV event reporting in primary port...
ModemManager[881]: <debug> [1678807455.808745] [ttyACM1/at] device open count is 4 (open)
ModemManager[881]: <debug> [1678807455.808857] [ttyACM1/at] device open count is 3 (close)
ModemManager[881]: <debug> [1678807455.808976] [ttyACM1/at] --> 'AT+CGEREP=2<CR>'
ModemManager[881]: <debug> [1678807455.827746] [ttyACM1/at] <-- '<CR><LF>OK<CR><LF>'
ModemManager[881]: <debug> [1678807455.828002] [modem0] enabling +CGEV event reporting in secondary port...
ModemManager[881]: <debug> [1678807455.828140] [ttyACM2/at] device open count is 2 (open)
ModemManager[881]: <debug> [1678807455.828237] [ttyACM1/at] device open count is 2 (close)
ModemManager[881]: <debug> [1678807455.828349] [ttyACM2/at] --> 'AT+CGEREP=2<CR>'
ModemManager[881]: <debug> [1678807455.847124] [ttyACM2/at] <-- '<CR><LF>OK<CR><LF>'
ModemManager[881]: <debug> [1678807455.847409] [ttyACM1/at] device open count is 3 (open)
ModemManager[881]: <debug> [1678807455.847546] [ttyACM2/at] device open count is 1 (close)
ModemManager[881]: <debug> [1678807455.847657] [ttyACM1/at] --> 'AT^SCFG="URC/DstIfc","app"<CR>'
ModemManager[881]: <debug> [1678807456.238531] [ttyACM1/at] <-- '<CR><LF>+CME ERROR: 21<CR><LF>'
ModemManager[881]: <debug> [1678807456.238769] [ttyACM1/at] operation failure: 21 (Invalid index)
ModemManager[881]: <debug> [1678807456.238868] [modem0] (cinterion) couldn't guarantee unsolicited events are sent to the correct port: Invalid index
ModemManager[881]: <debug> [1678807456.238961] [ttyACM1/at] device open count is 4 (open)
ModemManager[881]: <debug> [1678807456.239050] [ttyACM1/at] device open count is 3 (close)
ModemManager[881]: <debug> [1678807456.239172] [ttyACM1/at] --> 'AT^SIND="psinfo",1<CR>'
ModemManager[881]: <debug> [1678807456.265534] [ttyACM1/at] <-- '<CR><LF>^SIND: psinfo,1,4<CR><LF>'
ModemManager[881]: <debug> [1678807456.266115] [ttyACM1/at] <-- '<CR><LF>OK<CR><LF>'
ModemManager[881]: <debug> [1678807456.266376] [modem0] (cinterion) reporting initial access technologies...
ModemManager[881]: <debug> [1678807456.266578] [modem0] access technology changed (unknown -> edge)
ModemManager[881]: <debug> [1678807456.267297] [modem0] setting up 3GPP unsolicited registration messages handlers in ttyACM1
ModemManager[881]: <debug> [1678807456.267438] [modem0] setting up 3GPP unsolicited registration messages handlers in ttyACM2
ModemManager[881]: <debug> [1678807456.267602] [ttyACM1/at] device open count is 2 (close)
ModemManager[881]: <debug> [1678807456.268121] [ttyACM1/at] device open count is 3 (open)
ModemManager[881]: <debug> [1678807456.268350] [ttyACM1/at] --> 'AT+CREG=2<CR>'
ModemManager[881]: <debug> [1678807456.284023] [ttyACM1/at] <-- '<CR><LF>OK<CR><LF>'
ModemManager[881]: <debug> [1678807456.284342] [ttyACM2/at] device open count is 2 (open)
ModemManager[881]: <debug> [1678807456.284453] [ttyACM1/at] device open count is 2 (close)
ModemManager[881]: <debug> [1678807456.284546] [ttyACM2/at] --> 'AT+CREG=2<CR>'
ModemManager[881]: <debug> [1678807456.302027] [ttyACM2/at] <-- '<CR><LF>OK<CR><LF>'
ModemManager[881]: <debug> [1678807456.302333] [ttyACM1/at] device open count is 3 (open)
ModemManager[881]: <debug> [1678807456.302444] [ttyACM2/at] device open count is 1 (close)
ModemManager[881]: <debug> [1678807456.302539] [ttyACM1/at] --> 'AT+CGREG=2<CR>'
ModemManager[881]: <debug> [1678807456.321140] [ttyACM1/at] <-- '<CR><LF>OK<CR><LF>'
ModemManager[881]: <debug> [1678807456.321437] [ttyACM2/at] device open count is 2 (open)
ModemManager[881]: <debug> [1678807456.321556] [ttyACM1/at] device open count is 2 (close)
ModemManager[881]: <debug> [1678807456.321650] [ttyACM2/at] --> 'AT+CGREG=2<CR>'
ModemManager[881]: <debug> [1678807456.339412] [ttyACM2/at] <-- '<CR><LF>OK<CR><LF>'
ModemManager[881]: <debug> [1678807456.339683] [ttyACM1/at] device open count is 3 (open)
ModemManager[881]: <debug> [1678807456.339793] [ttyACM2/at] device open count is 1 (close)
ModemManager[881]: <debug> [1678807456.339895] [ttyACM1/at] --> 'AT+CEREG=2<CR>'
ModemManager[881]: <debug> [1678807456.358271] [ttyACM1/at] <-- '<CR><LF>OK<CR><LF>'
ModemManager[881]: <debug> [1678807456.358561] [ttyACM2/at] device open count is 2 (open)
ModemManager[881]: <debug> [1678807456.358667] [ttyACM1/at] device open count is 2 (close)
ModemManager[881]: <debug> [1678807456.358761] [ttyACM2/at] --> 'AT+CEREG=2<CR>'
ModemManager[881]: <debug> [1678807456.376943] [ttyACM2/at] <-- '<CR><LF>OK<CR><LF>'
ModemManager[881]: <debug> [1678807456.377278] [ttyACM1/at] device open count is 3 (open)
ModemManager[881]: <debug> [1678807456.377398] [ttyACM2/at] device open count is 1 (close)
ModemManager[881]: <debug> [1678807456.377495] [ttyACM1/at] --> 'AT+CGDCONT?<CR>'
ModemManager[881]: <debug> [1678807456.407673] [ttyACM1/at] <-- '<CR><LF>OK<CR><LF>'
Segmentation fault (core dumped)
I already found the reason of this crash. For some reason default 3gpp profile is not created (is it expected behavior?) and mm_3gpp_parse_cgdcont_read_response()
returns NULL. In this case, the error
variable is not initialized, and the error->message
causes a segmentation fault. Adding a simple if
statement will fix this bug. I created MR which adds required check.
Edited by Kirill Buksha