summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2012-04-03 20:10:03 +0000
committerShaun Ruffell <sruffell@digium.com>2012-04-03 20:10:03 +0000
commit3625c5dc5d694ffc3795b5f46c3b0e97686374e9 (patch)
tree24b750ac1e6d0b696593b133d52d258ddbef897f /include
parent8b55e255fe5c5539d5550d0ebf2624e44275b6ae (diff)
dahdi_dynamic: Do not call into dahdi_dynamic without holding reference.
Instead of registering a function pointer, register a dahdi_dynamic_ops structure that contains the owner as well as the ioctl callback. This way dahdi.ko can bump up the reference count on dahdi_dynamic.ko before calling the ioctl callback. Also, use the registration mutex to guard against the module being unloaded between the time the structure pointer was checked, and the module reference is taken. Signed-off-by: Shaun Ruffell <sruffell@digium.com> Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=10623 git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/branches/2.6@10628 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'include')
-rw-r--r--include/dahdi/kernel.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h
index c3a8dd5..13bbb20 100644
--- a/include/dahdi/kernel.h
+++ b/include/dahdi/kernel.h
@@ -1280,8 +1280,13 @@ extern u_char __dahdi_lin2mu[16384];
extern u_char __dahdi_lin2a[16384];
#endif
+struct dahdi_dynamic_ops {
+ struct module *owner;
+ int (*ioctl)(unsigned int cmd, unsigned long data);
+};
+
/*! \brief Used by dynamic DAHDI -- don't use directly */
-void dahdi_set_dynamic_ioctl(int (*func)(unsigned int cmd, unsigned long data));
+void dahdi_set_dynamic_ops(const struct dahdi_dynamic_ops *ops);
/*! \brief Used by DAHDI HPEC module -- don't use directly */
void dahdi_set_hpec_ioctl(int (*func)(unsigned int cmd, unsigned long data));