Skip to content

libqmi-glib,device: check message id before assuming valid response

If the transaction id ends up mismatched between device and libqmi due to some reason, we may end up assuming a response is of a given type when it isn't in reality.

Make sure this does not happen, as this would end up triggering a g_return_val_if_fail() check that returns a NULL reply by the parser without GError set, and the users of libqmi, like MM here may not like that:

  ERR daemon ModemManager[4842]: __qmi_message_ctl_set_data_format_response_parse: assertion 'qmi_message_get_message_id (message) == QMI_MESSAGE_CTL_SET_DATA_FORMAT' failed
  ERR daemon ModemManager[4842]: __qmi_message_ctl_allocate_cid_response_parse: assertion 'qmi_message_get_message_id (message) == QMI_MESSAGE_CTL_ALLOCATE_CID' failed
  WARNIN user kernel:[ 687.347162] /tmp/ModemManager.4842.6.1575343251.core core dumped

The internal response_parse() methods used by libqmi should always be used when we know that the response matches the expected type.

Edited by Aleksander Morgado

Merge request reports