dahdi_dynamic: Do not call into dahdi_dynamic without holding reference.
authorShaun Ruffell <sruffell@digium.com>
Tue, 3 Apr 2012 20:10:03 +0000 (20:10 +0000)
committerShaun Ruffell <sruffell@digium.com>
Tue, 3 Apr 2012 20:10:03 +0000 (20:10 +0000)
commit69774cd457648ceb6e0d2b75bebe4ff2540efc97
tree24b750ac1e6d0b696593b133d52d258ddbef897f
parent9dde3cff9cb2d52013dea9d24ebeaa5a7c36dee7
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
drivers/dahdi/dahdi-base.c
drivers/dahdi/dahdi_dynamic.c
include/dahdi/kernel.h