summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrussell <russell@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2005-03-31 22:57:19 +0000
committerrussell <russell@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2005-03-31 22:57:19 +0000
commit5fe0a866899dbafdc294eedb33671f603997627c (patch)
tree6fe3c1c367d3642d1affcc5d1d414c7ad5914a4c
parentf8130503936dbdc1e1d837f0cefa26ab8d7e7710 (diff)
add use counts to prevent kernel panics (bug #3773)
git-svn-id: http://svn.digium.com/svn/zaptel/branches/v1-0@610 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rwxr-xr-xwcfxs.c6
-rwxr-xr-xwct4xxp.c5
-rwxr-xr-xwcte11xp.c4
3 files changed, 14 insertions, 1 deletions
diff --git a/wcfxs.c b/wcfxs.c
index 4377298..8a21d9b 100755
--- a/wcfxs.c
+++ b/wcfxs.c
@@ -1660,7 +1660,9 @@ static int wcfxs_open(struct zt_chan *chan)
wc->usecount++;
#ifndef LINUX26
MOD_INC_USE_COUNT;
-#endif
+#else
+ try_module_get(THIS_MODULE);
+#endif
return 0;
}
@@ -1678,6 +1680,8 @@ static int wcfxs_close(struct zt_chan *chan)
wc->usecount--;
#ifndef LINUX26
MOD_DEC_USE_COUNT;
+#else
+ module_put(THIS_MODULE);
#endif
for (x=0;x<wc->cards;x++)
wc->mod.fxs.idletxhookstate[x] = 1;
diff --git a/wct4xxp.c b/wct4xxp.c
index 104ed2e..05694ef 100755
--- a/wct4xxp.c
+++ b/wct4xxp.c
@@ -544,7 +544,10 @@ static int t4_open(struct zt_chan *chan)
{
#ifndef LINUX26
MOD_INC_USE_COUNT;
+#else
+ try_module_get(THIS_MODULE);
#endif
+
return 0;
}
@@ -552,6 +555,8 @@ static int t4_close(struct zt_chan *chan)
{
#ifndef LINUX26
MOD_DEC_USE_COUNT;
+#else
+ module_put(THIS_MODULE);
#endif
return 0;
}
diff --git a/wcte11xp.c b/wcte11xp.c
index 7d5a361..1df94b5 100755
--- a/wcte11xp.c
+++ b/wcte11xp.c
@@ -226,6 +226,8 @@ static int t1xxp_open(struct zt_chan *chan)
wc->usecount++;
#ifndef LINUX26
MOD_INC_USE_COUNT;
+#else
+ try_module_get(THIS_MODULE);
#endif
return 0;
}
@@ -346,6 +348,8 @@ static int t1xxp_close(struct zt_chan *chan)
wc->usecount--;
#ifndef LINUX26
MOD_DEC_USE_COUNT;
+#else
+ module_put(THIS_MODULE);
#endif
/* If we're dead, release us now */
if (!wc->usecount && wc->dead)