diff --git a/SOURCES/0002-port-serial-un-schedule-flash-operation-as-soon-as-i.patch b/SOURCES/0002-port-serial-un-schedule-flash-operation-as-soon-as-i.patch new file mode 100644 index 0000000..07eb4f2 --- /dev/null +++ b/SOURCES/0002-port-serial-un-schedule-flash-operation-as-soon-as-i.patch @@ -0,0 +1,56 @@ +From 21e5b1d68336ec5a19f71e36c035e19d29623ca2 Mon Sep 17 00:00:00 2001 +From: Aleksander Morgado +Date: Tue, 31 Dec 2019 15:40:13 +0100 +Subject: [PATCH] port-serial: un-schedule flash operation as soon as it's + cancelled + +When a flash operation is started, it is always scheduled in an idle. +If this operation is cancelled, we should right away un-schedule it, +otherwise we may end up calling flash_do() with the GTask in the +private info already gone. + +See https://gitlab.freedesktop.org/mobile-broadband/ModemManager/merge_requests/178#note_330017 +--- + src/mm-port-serial.c | 18 ++++++++++++++---- + 1 file changed, 14 insertions(+), 4 deletions(-) + +diff --git a/src/mm-port-serial.c b/src/mm-port-serial.c +index 3101ce6e..6d5ee1b1 100644 +--- a/src/mm-port-serial.c ++++ b/src/mm-port-serial.c +@@ -1744,18 +1744,28 @@ flash_cancel_cb (GTask *task) + void + mm_port_serial_flash_cancel (MMPortSerial *self) + { +- GTask *task; ++ FlashContext *ctx; ++ GTask *task; + + /* Do nothing if there is no flash task */ + if (!self->priv->flash_task) + return; + +- /* Recover task and schedule it to be cancelled in an idle. ++ /* Recover task */ ++ task = self->priv->flash_task; ++ self->priv->flash_task = NULL; ++ ++ /* If flash operation is scheduled, unschedule it */ ++ ctx = g_task_get_task_data (task); ++ if (ctx->flash_id) { ++ g_source_remove (ctx->flash_id); ++ ctx->flash_id = 0; ++ } ++ ++ /* Schedule task to be cancelled in an idle. + * We do NOT want this cancellation to happen right away, + * because the object reference in the flashing task may + * be the last one valid. */ +- task = self->priv->flash_task; +- self->priv->flash_task = NULL; + g_idle_add ((GSourceFunc)flash_cancel_cb, task); + } + +-- +2.24.1 + diff --git a/SPECS/ModemManager.spec b/SPECS/ModemManager.spec index c42d56d..8c50d27 100644 --- a/SPECS/ModemManager.spec +++ b/SPECS/ModemManager.spec @@ -7,9 +7,10 @@ Summary: Mobile broadband modem management service Name: ModemManager Version: 1.10.8 -Release: 1%{?dist} +Release: 2%{?dist} Source: https://www.freedesktop.org/software/ModemManager/%{name}-%{version}.tar.xz Patch0: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/commit/fd1a26fc36df.patch#/0001-plugin-ignore-unwanted-net-ports.patch +Patch1: 0002-port-serial-un-schedule-flash-operation-as-soon-as-i.patch License: GPLv2+ Group: System Environment/Base @@ -92,6 +93,7 @@ Vala bindings for ModemManager %prep %setup -q %patch0 -p1 +%patch1 -p1 %build # Regenerate configure, because the one that is shipped @@ -191,6 +193,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : %{_datadir}/vala/vapi/libmm-glib.* %changelog +* Fri Feb 14 2020 Antonio Cardace - 1.10.8-2 +- Fix race condition when cancelling a flash operation (rh #1758128) + * Fri Nov 29 2019 Lubomir Rintel - 1.10.8-1 - Update to 1.10.8 release