From 50ad39b28e61adb3d9da178c47e41100f554adeb Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 19 Jan 2010 03:16:34 -0800 Subject: core: protect against modem removal in critical callbacks (rh #553953) There are more places to handle, but these are the most critical. If the modem is removed while a command is in-progress, the mm-callback-info code will set info->modem to NULL. Make sure we check for that in callbacks and return a reasonable error. Previous code would just blindly forge ahead and die on a null dereference. --- src/mm-callback-info.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/mm-callback-info.c') diff --git a/src/mm-callback-info.c b/src/mm-callback-info.c index b554f79b..1882898a 100644 --- a/src/mm-callback-info.c +++ b/src/mm-callback-info.c @@ -11,6 +11,7 @@ * GNU General Public License for more details: * * Copyright (C) 2008 Novell, Inc. + * Copyright (C) 2009 - 2010 Red Hat, Inc. */ #include "mm-callback-info.h" @@ -55,8 +56,8 @@ modem_destroyed_cb (gpointer data, GObject *destroyed) info->modem = NULL; if (!info->pending_id) { info->error = g_error_new_literal (MM_MODEM_ERROR, - MM_MODEM_ERROR_GENERAL, - "The modem was removed or disabled."); + MM_MODEM_ERROR_REMOVED, + "The modem was removed."); mm_callback_info_schedule (info); } } -- cgit v1.2.3-70-g09d2