[svn-commits] sruffell: branch linux/sruffell/wctdm24xxp-updates r10125 - /linux/team/sruff...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Aug 12 19:36:02 CDT 2011


Author: sruffell
Date: Fri Aug 12 19:35:59 2011
New Revision: 10125

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10125
Log:
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 at digium.com>

Modified:
    linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/base.c

Modified: linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/base.c?view=diff&rev=10125&r1=10124&r2=10125
==============================================================================
--- linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/base.c Fri Aug 12 19:35:59 2011
@@ -4505,6 +4505,8 @@
 {
 	int res;
 	struct vpmadt032_options options;
+	struct vpmadt032 *vpm;
+	unsigned long flags;
 
 	options.debug = debug;
 	options.vpmnlptype = vpmnlptype;
@@ -4524,8 +4526,11 @@
 	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;
 	}
 
@@ -4533,8 +4538,11 @@
 	 * 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;
 	}
 
@@ -5817,8 +5825,10 @@
 	voicebus_stop(&wc->vb);
 
 	if (vpmadt032) {
+		spin_lock_irqsave(&wc->reglock, flags);
+		wc->vpmadt032 = NULL;
+		spin_unlock_irqrestore(&wc->reglock, flags);
 		vpmadt032_free(vpmadt032);
-		wc->vpmadt032 = NULL;
 	} else if (vpmoct) {
 		spin_lock_irqsave(&wc->reglock, flags);
 		wc->vpmoct = NULL;




More information about the svn-commits mailing list