From 50044fdc15197b3a4a742827c97fc25daddc98aa Mon Sep 17 00:00:00 2001 From: Corey Farrell Date: Fri, 22 May 2015 22:50:43 -0400 Subject: Stasis: Fix unsafe use of stasis_unsubscribe in modules. Many uses of stasis_unsubscribe in modules can be reached through unload. These have been switched to stasis_unsubscribe_and_join. Some subscription callbacks do nothing, for these I've created a noop callback function in stasis.c. This is used by some modules that monitor MWI topics in order to enable cache, since the callback does not become invalid after dlclose it is safe to use stasis_unsubscribe on these, even during module unload. ASTERISK-25121 #close Change-Id: Ifc2549fbd8eef7d703c222978e8f452e2972189c --- channels/chan_dahdi.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'channels/chan_dahdi.c') diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index 2f637dcfe..fe613097c 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -600,14 +600,6 @@ static int restart_monitor(void); static int dahdi_sendtext(struct ast_channel *c, const char *text); -static void mwi_event_cb(void *userdata, struct stasis_subscription *sub, struct stasis_message *msg) -{ - /* This module does not handle MWI in an event-based manner. However, it - * subscribes to MWI for each mailbox that is configured so that the core - * knows that we care about it. Then, chan_dahdi will get the MWI from the - * event cache instead of checking the mailbox directly. */ -} - /*! \brief Avoid the silly dahdi_getevent which ignores a bunch of events */ static inline int dahdi_get_event(int fd) { @@ -12593,7 +12585,11 @@ static struct dahdi_pvt *mkintf(int channel, const struct dahdi_chan_conf *conf, mailbox_specific_topic = ast_mwi_topic(tmp->mailbox); if (mailbox_specific_topic) { - tmp->mwi_event_sub = stasis_subscribe_pool(mailbox_specific_topic, mwi_event_cb, NULL); + /* This module does not handle MWI in an event-based manner. However, it + * subscribes to MWI for each mailbox that is configured so that the core + * knows that we care about it. Then, chan_dahdi will get the MWI from the + * event cache instead of checking the mailbox directly. */ + tmp->mwi_event_sub = stasis_subscribe_pool(mailbox_specific_topic, stasis_subscription_cb_noop, NULL); } } #ifdef HAVE_DAHDI_LINEREVERSE_VMWI -- cgit v1.2.3