spa: bluez: fix crash when receiving signal from modemmanager

6e581deb91 added an `spa_autoptr(DbusMessage) m`
for the new message sent out when a signal is received from modemmanager.
However this ended up shadowing the original `m` function arg,
so the code that wanted to interrogate the original arg with
`dbus_get_message_path` etc ended up interrogating this `NULL` value instead.
This triggered a NULL-check in `dbus_get_message_path` and caused
the process to abort.

Original downstream report: https://gitlab.com/postmarketOS/pmaports/-/issues/2886
This commit is contained in:
Arnav Singh 2024-06-15 10:11:38 -07:00
parent e045ef0e4c
commit 2501b347ef
No known key found for this signature in database
GPG key ID: 89A451A9C0E3AF0B

View file

@ -570,7 +570,7 @@ static DBusHandlerResult mm_filter_cb(DBusConnection *bus, DBusMessage *m, void
const char *path;
struct call *call_object;
const char *mm_call_interface = MM_DBUS_INTERFACE_CALL;
spa_autoptr(DBusMessage) m = NULL;
spa_autoptr(DBusMessage) m2 = NULL;
if (!spa_streq(this->modem.path, dbus_message_get_path(m)))
goto finish;
@ -590,12 +590,12 @@ static DBusHandlerResult mm_filter_cb(DBusConnection *bus, DBusMessage *m, void
call_object->path = strdup(path);
spa_list_append(&this->call_list, &call_object->link);
m = dbus_message_new_method_call(MM_DBUS_SERVICE, path, DBUS_INTERFACE_PROPERTIES, "GetAll");
if (m == NULL)
m2 = dbus_message_new_method_call(MM_DBUS_SERVICE, path, DBUS_INTERFACE_PROPERTIES, "GetAll");
if (m2 == NULL)
goto finish;
dbus_message_append_args(m, DBUS_TYPE_STRING, &mm_call_interface, DBUS_TYPE_INVALID);
dbus_message_append_args(m2, DBUS_TYPE_STRING, &mm_call_interface, DBUS_TYPE_INVALID);
call_object->pending = send_with_reply(this->conn, m, mm_get_call_properties_reply, call_object);
call_object->pending = send_with_reply(this->conn, m2, mm_get_call_properties_reply, call_object);
if (!call_object->pending) {
spa_log_error(this->log, "dbus call failure");
goto finish;