[Asterisk-code-review] res pjsip: Patch for res pjsip * module load/reload crash (asterisk[13])

Corey Farrell asteriskteam at digium.com
Tue Nov 27 11:22:00 CST 2018


Corey Farrell has uploaded this change for review. ( https://gerrit.asterisk.org/10716


Change subject: res_pjsip: Patch for res_pjsip_* module load/reload crash
......................................................................

res_pjsip: Patch for res_pjsip_* module load/reload crash

The session_supplements for the pjsip makes crashes when the module
load/unload.

ASTERISK-28157

Change-Id: I5b82be3a75d702cf1933d8d1417f44aa10ad1029
---
M include/asterisk/res_pjsip_session.h
M res/res_pjsip/pjsip_session.c
2 files changed, 15 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/16/10716/1

diff --git a/include/asterisk/res_pjsip_session.h b/include/asterisk/res_pjsip_session.h
index 0c2b1e3..e2d4fcd 100644
--- a/include/asterisk/res_pjsip_session.h
+++ b/include/asterisk/res_pjsip_session.h
@@ -533,10 +533,14 @@
  * a module could reject an incoming request if desired.
  *
  * \param supplement The supplement to register
+ * \param module Referenced module(NULL safe)
  * \retval 0 Success
  * \retval -1 Failure
  */
-int ast_sip_session_register_supplement(struct ast_sip_session_supplement *supplement);
+int ast_sip_session_register_supplement_with_module(struct ast_module *module, struct ast_sip_session_supplement *supplement);
+
+#define ast_sip_session_register_supplement(supplement) \
+		ast_sip_session_register_supplement_with_module(ast_module_info->self, supplement)
 
 /*!
  * \brief Unregister a an supplement to SIP session processing
diff --git a/res/res_pjsip/pjsip_session.c b/res/res_pjsip/pjsip_session.c
index 074ec4e..2002bbd 100644
--- a/res/res_pjsip/pjsip_session.c
+++ b/res/res_pjsip/pjsip_session.c
@@ -56,10 +56,11 @@
 	}
 }
 
-int ast_sip_session_register_supplement(struct ast_sip_session_supplement *supplement)
+int ast_sip_session_register_supplement_with_module(struct ast_module *module, struct ast_sip_session_supplement *supplement)
 {
 	internal_sip_session_register_supplement(supplement);
 	internal_res_pjsip_ref();
+	ast_module_shutdown_ref(module);
 
 	return 0;
 }
@@ -118,3 +119,11 @@
 
 	return 0;
 }
+
+/* This stub is for ABI compatibility. */
+#undef ast_sip_session_register_supplement
+int ast_sip_session_register_supplement(struct ast_sip_session_supplement *supplement);
+int ast_sip_session_register_supplement(struct ast_sip_session_supplement *supplement)
+{
+	return ast_sip_session_register_supplement_with_module(NULL, supplement);
+}

-- 
To view, visit https://gerrit.asterisk.org/10716
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5b82be3a75d702cf1933d8d1417f44aa10ad1029
Gerrit-Change-Number: 10716
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20181127/18c63d11/attachment.html>


More information about the asterisk-code-review mailing list