wctdm24xxp: Protect creation / destruction of VPM instance.

Closes a small window of opportunity where one CPU might free a VPM
instance that the interrupt handler may currently be using.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10162 a0bf4364-ded3-4de4-8d8a-66a801d63aff
This commit is contained in:
Shaun Ruffell 2011-08-30 16:38:06 +00:00
parent 3d8629e864
commit 25cb4126c8
1 changed files with 13 additions and 3 deletions

View File

@ -4518,6 +4518,8 @@ static int wctdm_initialize_vpmadt032(struct wctdm *wc)
{
int res;
struct vpmadt032_options options;
struct vpmadt032 *vpm;
unsigned long flags;
options.debug = debug;
options.vpmnlptype = vpmnlptype;
@ -4537,8 +4539,11 @@ static int wctdm_initialize_vpmadt032(struct wctdm *wc)
if (!res)
res = vpmadt032_init(wc->vpmadt032);
if (res) {
vpmadt032_free(wc->vpmadt032);
vpm = wc->vpmadt032;
spin_lock_irqsave(&wc->reglock, flags);
wc->vpmadt032 = NULL;
spin_unlock_irqrestore(&wc->reglock, flags);
vpmadt032_free(vpm);
return res;
}
@ -4546,8 +4551,11 @@ static int wctdm_initialize_vpmadt032(struct wctdm *wc)
* particular board. */
res = config_vpmadt032(wc->vpmadt032, wc);
if (res) {
vpmadt032_free(wc->vpmadt032);
vpm = wc->vpmadt032;
spin_lock_irqsave(&wc->reglock, flags);
wc->vpmadt032 = NULL;
spin_unlock_irqrestore(&wc->reglock, flags);
vpmadt032_free(vpm);
return res;
}
@ -5866,8 +5874,10 @@ static void __devexit wctdm_remove_one(struct pci_dev *pdev)
voicebus_stop(&wc->vb);
if (vpmadt032) {
vpmadt032_free(vpmadt032);
spin_lock_irqsave(&wc->reglock, flags);
wc->vpmadt032 = NULL;
spin_unlock_irqrestore(&wc->reglock, flags);
vpmadt032_free(vpmadt032);
} else if (vpmoct) {
spin_lock_irqsave(&wc->reglock, flags);
wc->vpmoct = NULL;