rilmodem: Do not always use sim's app in status->gsm_umts_index

Bug #1427788 reported by Ratchanan Srirattanamet
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical System Image
Fix Released
High
Unassigned
ofono (Ubuntu)
Fix Released
High
Tony Espy

Bug Description

In driver/rilmodem/sim.c, function sim_status_cb, there is a line that set variable search_index to status->gsm_utms_index.

The code then checks if the card_state returned by the GET_SIM_STATUS reply is PRESENT and search_index is less than num_apps. If both are true, search_index is used to index the returned reply_sim_app array ( which leads to undefined behavior if the index is negative ) and then passed to configure_active_app().

The code should check search index, and if negative and num_apps >=1, set search_index to 0.

ofono version 1.12.bzr6888+15.04.20150224 in Ubuntu 15.04
Device: LG L90 Dual (I'm doing a port.)

Related branches

Tony Espy (awe)
Changed in ofono (Ubuntu):
status: New → Confirmed
assignee: nobody → Tony Espy (awe)
importance: Undecided → High
Tony Espy (awe)
description: updated
Revision history for this message
Tony Espy (awe) wrote :
Changed in ofono (Ubuntu):
status: Confirmed → In Progress
Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote :

Looking at the definition of the reply to RIL_REQUEST_GET_SIM_STATUS in

http://androidxref.com/4.4.2_r1/xref/hardware/ril/include/telephony/ril.h

I see that if RIL_CardStatus_v6::gsm_umts_subscription_app_index value in the parcel is -1, it *should* mean that there is no GSM/UMTS application in the SIM card. However, this looks broken in many implementations (I get, for instance, index 8 for "cdma_subscription_app_index" with one phone, although "num_applications" is just one. The phone is not CDMA, so I guess the card is from a GSM operator and really has a SIM/USIM application.

Maybe the right approach here is to not use the indexes in RIL_CardStatus_v6 and look directly at the array RIL_CardStatus_v6::applications, as each of them has an application type.

@Ratchanan, would it be possible to obtain the full hex traces from you phone? To get them please do as root in the phone:

# stop ofono
# OFONO_RIL_TRACE="" OFONO_RIL_HEX_TRACE="" OFONO_RIL_DEVICE=ril ofonod -n -d -P stktest,provision,sap,udev,dun,smart,hfp >& /tmp/ofono.txt

let it run for a few seconds and please attach the resulting file to the bug.

Revision history for this message
Ratchanan Srirattanamet (peat-new) wrote :

@Alfonso, I've attached the log. But I think I know why gsm_umts_index is -1 now. After reading the log from Cyanogenmod, I've found that I need to make another request to rild to select app we'll use. I actually have a patch (hack!) that make my phone register with the network and talks USSD, but I think it's out of scope of this bug now.

Revision history for this message
Ratchanan Srirattanamet (peat-new) wrote :

Sorry, attach wrong file.

Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote :

@Ratchanan, thanks for the log. This implies that we should not really use the index if set to -1 for your modem, but send the request for selecting an application before. Great to know that you are already able to register, maybe getting ofonod to work will just need a couple of minor adjustments. If that is the case, you could define a new vendor in

drivers/rilmodem/vendor.h

and use it as necessary. The repo we use for our development is

https://github.com/rilmodem/ofono

Patches are always welcome ;)

Revision history for this message
Tony Espy (awe) wrote :

As this patch was merged into our upstream git repository, I'm changing the Status to FixCommitted. See the following pull-request for details:

https://github.com/rilmodem/ofono/pull/174

Changed in ofono (Ubuntu):
status: In Progress → Fix Committed
Changed in canonical-devices-system-image:
importance: Undecided → High
milestone: none → ww22-2015
status: New → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ofono - 1.12.bzr6896+15.10.20150521-0ubuntu1

---------------
ofono (1.12.bzr6896+15.10.20150521-0ubuntu1) wily; urgency=medium

  [ Ratchanan Srirattanamet ]
  * build, gril, rilmodem, qcommsimmodem, plugins/qcom-msim.c: add
    support for LG L90 Dual which uses a Qualcomm dual-SIM modem (LP: #1427788)

  [ Alfonso Sanchez-Beato ]
  * src/gprs.c: support for 'ResetContexts' (LP: #1338758)
    Adds a new ConnectionManager 'ResetContexts' DBus method
    which deletes all existing gprs contexts and forces
    re-provisioning to occur.
  * plugins/ubuntu-apndb.c: ignore 'ipv6' protocol
    This change causes APNs with an 'ipv6' protocol value
    to instead be provisioned with 'ip', forcing IPv4 to
    be used.

  [ Jonas Drange ]
  * doc/connman-api.txt: add metion of 'ia' gprs context type

  [ Tony Espy ]
  * test/set-context-property: add 'Preferred' support (LP: #1454756, #1454751)
    This change adds support for the 'Preferred' ( and 'Active')
    properties which both need to be DBus variant wrapped booleans.
    Also added support for multi-SIM which was lacking from this script.
  * test/list-modems: add privacy support (LP: #1438715)
    Obfuscate any properties which can be tied to the end-user
    ( eg. SubscriberNumbers, SubscriberIdentity, ... ).

 -- CI Train Bot <email address hidden> Thu, 21 May 2015 08:44:39 +0000

Changed in ofono (Ubuntu):
status: Fix Committed → Fix Released
Changed in canonical-devices-system-image:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.