broadband-modem-qmi,broadband-modem-mbim: always use SMS_PART_INVALID_INDEX unstored parts

MMSmsList has logic to allow multiple unstored messages as long as
they use SMS_PART_INVALID_INDEX. These messages aren't stored so
they don't have an index.

But the MBIM and QMI modems used index 0 for unstored messages,
meaning there could only ever be one and also that multipart
messages would fail to be combined.

Let's fix that by just using SMS_PART_INVALID_INDEX for every
scenario where an unstored message comes in.

Fixes: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/979

Signed-off-by: Dan Williams <dan@ioncontrol.co>
(cherry picked from commit 1d5cc0addb)
This commit is contained in:
Dan Williams
2025-05-08 20:44:02 -05:00
parent 958bc69299
commit 19f6d15edf
2 changed files with 29 additions and 12 deletions
+26 -5
View File
@@ -5840,6 +5840,7 @@ static gboolean process_pdu_messages (MMBroadbandModemMbim *self,
guint32 messages_count,
MbimSmsPduReadRecordArray *pdu_messages,
guint expected_index,
gboolean unstored,
GError **error);
static void
@@ -5864,6 +5865,7 @@ sms_notification_read_flash_sms (MMBroadbandModemMbim *self,
messages_count,
pdu_messages,
SMS_PART_INVALID_INDEX,
TRUE,
&error))
mm_obj_dbg (self, "flash SMS message reading failed: %s", error->message);
}
@@ -5943,6 +5945,7 @@ alert_sms_read_query_ready (MbimDevice *device,
messages_count,
pdu_messages,
ctx->expected_index,
FALSE,
&error))
mm_obj_dbg (ctx->self, "SMS message reading failed: %s", error->message);
@@ -9024,12 +9027,13 @@ load_initial_sms_parts_finish (MMIfaceModemMessaging *self,
static void
add_sms_part (MMBroadbandModemMbim *self,
const MbimSmsPduReadRecord *pdu,
guint part_index,
guint expected_index)
{
MMSmsPart *part;
g_autoptr(GError) error = NULL;
part = mm_sms_part_3gpp_new_from_binary_pdu (pdu->message_index,
part = mm_sms_part_3gpp_new_from_binary_pdu (part_index,
pdu->pdu_data,
pdu->pdu_data_size,
self,
@@ -9062,6 +9066,7 @@ process_pdu_messages (MMBroadbandModemMbim *self,
guint32 messages_count,
MbimSmsPduReadRecordArray *pdu_messages,
guint expected_index,
gboolean unstored,
GError **error)
{
guint i;
@@ -9087,11 +9092,26 @@ process_pdu_messages (MMBroadbandModemMbim *self,
mm_obj_dbg (self, "%u SMS PDUs reported", messages_count);
for (i = 0; i < messages_count; i++) {
if (pdu_messages[i]) {
mm_obj_dbg (self, "processing SMS PDU %u/%u...", i+1, messages_count);
add_sms_part (self, pdu_messages[i], expected_index);
} else
guint message_index;
if (!pdu_messages[i]) {
mm_obj_dbg (self, "ignoring invalid SMS PDU %u/%u...", i+1, messages_count);
continue;
}
mm_obj_dbg (self, "processing SMS PDU %u/%u...", i+1, messages_count);
message_index = pdu_messages[i]->message_index;
if (unstored && message_index != 0) {
mm_obj_warn (self,
"processed unstored PDU with non-zero message index (%u)",
message_index);
}
add_sms_part (self,
pdu_messages[i],
unstored ? SMS_PART_INVALID_INDEX : message_index,
expected_index);
}
return TRUE;
@@ -9126,6 +9146,7 @@ sms_read_query_ready (MbimDevice *device,
messages_count,
pdu_messages,
SMS_PART_INVALID_INDEX,
FALSE,
&error))
g_task_return_error (task, error);
else
+3 -7
View File
@@ -8380,7 +8380,6 @@ messaging_event_report_indication_cb (QmiClientNas *client,
QmiWmsAckIndicator ack_ind;
guint32 transaction_id;
QmiWmsMessageFormat msg_format;
QmiWmsMessageTagType tag;
GArray *raw_data = NULL;
/* Handle transfer-route MT messages */
@@ -8425,13 +8424,10 @@ messaging_event_report_indication_cb (QmiClientNas *client,
}
/* Defaults for transfer-route messages, which are not stored anywhere */
storage = QMI_WMS_STORAGE_TYPE_NONE;
memory_index = 0;
tag = QMI_WMS_MESSAGE_TAG_TYPE_MT_NOT_READ;
add_new_read_sms_part (MM_IFACE_MODEM_MESSAGING (self),
storage,
memory_index,
tag,
QMI_WMS_STORAGE_TYPE_NONE,
SMS_PART_INVALID_INDEX,
QMI_WMS_MESSAGE_TAG_TYPE_MT_NOT_READ,
msg_format,
TRUE,
raw_data);