diff options
author | Shaun Ruffell <sruffell@digium.com> | 2012-04-03 19:44:27 +0000 |
---|---|---|
committer | Shaun Ruffell <sruffell@digium.com> | 2012-04-03 19:44:27 +0000 |
commit | 5a9e9d4f8b7c38a9fff9e4c2c4499dcdee82d2e6 (patch) | |
tree | 8614408a2988c4c3c14d3d5bdfc3cbbda44da749 /include | |
parent | 6dbace7374c2f27f50762a5445b28960a135c718 (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>
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10623 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'include')
-rw-r--r-- | include/dahdi/kernel.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h index 8097cb3..9922f11 100644 --- a/include/dahdi/kernel.h +++ b/include/dahdi/kernel.h @@ -1260,8 +1260,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)); |