Skip to contentSkip to conversation

plugins: fixed crash in udevng

PATCH Applied James Prestwood 2 participants 2 messages May 22, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 plugins: fixed crash in udevng

The return value from ofono_modem_register was not being checked. If this fails the modem object is not setup and causes a crash. This was specifically seen when using the mbim driver without having configured with mbim support.

Now the modem object gets destroyed properly if the modem registration fails.

---
 plugins/udevng.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
plugins/udevng.c +5 -1
index cd56fd56..f4bf61cf 100644
@@ -1802,7 +1802,11 @@ static gboolean create_modem(gpointer key, gpointer value, gpointer user_data)
 		if (driver_list[i].setup(modem) == TRUE) {
 			ofono_modem_set_string(modem->modem, "SystemPath",
 								syspath);
-			ofono_modem_register(modem->modem);
+			if (ofono_modem_register(modem->modem) < 0) {
+				DBG("could not register modem '%s'", modem->driver);
+				return TRUE;
+			}
+
 			return FALSE;
 		}
 	}
Signature · 1 line
2.17.0
#1 lore raw

Hi James,

Quoted 9 lines · James Prestwood

The return value from ofono_modem_register was not being checked. If this fails the modem object is not setup and causes a crash. This was specifically seen when using the mbim driver without having configured with mbim support.

Now the modem object gets destroyed properly if the modem registration fails.

---
  plugins/udevng.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)

Applied, thanks.

Regards,
-Denis