summaryrefslogtreecommitdiff
path: root/drivers/ifxmodem
diff options
context:
space:
mode:
authorAnirudh Gargi <anirudh.gargi@intel.com>2018-10-01 11:49:13 +0530
committerDenis Kenzior <denkenz@gmail.com>2018-10-01 14:46:35 -0500
commit4b44fb391067fe7a870705f58215ea9d1feefc75 (patch)
treeba5d11a3214c681ce67e2b4e9c8a6c42305cda42 /drivers/ifxmodem
parent40f59163166d3cb0b4812f42472b6fa95dd56cc8 (diff)
downloadofono-4b44fb391067fe7a870705f58215ea9d1feefc75.tar.gz
gprs: fix seg fault in case of NULL callback
In case of AT callback if callback handler is NULL, check for null before calling the success macro. Logs: ofonod[32496]: src/network.c:current_operator_callback() 0x157ad60, (nil) ofonod[32496]: src/gprs.c:netreg_status_changed() 0 ofonod[32496]: src/gprs.c:gprs_netreg_update() attach: 0, driver_attached: 1 ofonod[32496]: src/gprs.c:ofono_gprs_detached_notify() /xmm7xxx_0 ofonod[32496]: drivers/ifxmodem/gprs-context.c:ifx_gprs_detach_shutdown() ofonod[32496]: drivers/ifxmodem/gprs-context.c:ifx_gprs_deactivate_primary() cid 0 ofonod[32496]: src/gprs.c:ofono_gprs_detached_notify() /xmm7xxx_0 ofonod[32496]: src/gprs.c:gprs_attach_callback() /xmm7xxx_0 error = 0 ofonod[32496]: drivers/ifxmodem/gprs-context.c:deactivate_cb() ok 0 ofonod[32496]: Aborting (signal 11) [./../src/ofonod] ofonod[32496]: ++++++++ backtrace ++++++++ ofonod[32496]: +++++++++++++++++++++++++++
Diffstat (limited to 'drivers/ifxmodem')
-rw-r--r--drivers/ifxmodem/gprs-context.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/ifxmodem/gprs-context.c b/drivers/ifxmodem/gprs-context.c
index 43e81c5d..885e41bb 100644
--- a/drivers/ifxmodem/gprs-context.c
+++ b/drivers/ifxmodem/gprs-context.c
@@ -514,6 +514,9 @@ static void deactivate_cb(gboolean ok, GAtResult *result, gpointer user_data)
if (gcd->vendor != OFONO_VENDOR_XMM)
g_at_chat_resume(gcd->chat);
+ if (!gcd->cb)
+ return;
+
CALLBACK_WITH_SUCCESS(gcd->cb, gcd->cb_data);
}