summaryrefslogtreecommitdiff
path: root/xivovp/base.c
diff options
context:
space:
mode:
authorNoe Rubinstein <nrubinstein@proformatique.com>2010-12-29 18:51:33 +0100
committerNoe Rubinstein <nrubinstein@proformatique.com>2010-12-29 18:52:28 +0100
commit0f99ebd48f28d1b92e053421410d1c81d9fb4da1 (patch)
treec77cb5165c15f27353cd66b119c8d9e535b9264c /xivovp/base.c
parent8c282bc10095f4bb08410c39d25a436a9839c927 (diff)
Remove useless/dangerous txsig queue
Diffstat (limited to 'xivovp/base.c')
-rw-r--r--xivovp/base.c38
1 files changed, 12 insertions, 26 deletions
diff --git a/xivovp/base.c b/xivovp/base.c
index 46932ff..8518c5e 100644
--- a/xivovp/base.c
+++ b/xivovp/base.c
@@ -41,8 +41,6 @@ MODULE_PARM_DESC(traces_vanish,
"to only ERROR/WARNING/INFO (default: "
__stringify(TRACES_VANISH_DEFAULT) ")");
-#define TXQUEUE_LEN 16 /* WARNING TOTHINK possible DoS attack
- by overrunning this queue */
#define NB_LINES 2
#define TICK_JIFFIES(n) DIV_ROUND_UP(n * HZ, 1000)
#define VP_TICK_JIFFIES TICK_JIFFIES(VP_TICK_MS)
@@ -70,8 +68,8 @@ struct xivovp_line {
VpLineCtxType vp_ctx;
struct dahdi_chan chan;
- enum dahdi_txsig txsig_queue[TXQUEUE_LEN];
- int txsig_queue_len; // is there a better/canonical way to write that?
+ int txsig_pending;
+ enum dahdi_txsig txsig;
spinlock_t lock;
@@ -135,18 +133,9 @@ static int xivovp_hooksig(struct dahdi_chan *chan, enum dahdi_txsig txsig)
struct xivovp_line* line = chan->pvt;
unsigned long flags;
- if (line->txsig_queue_len >= TXQUEUE_LEN) {
- printk(KERN_WARNING DRV_NAME "(chan %d): txsig overrun (%d)\n",
- chan->chanpos, txsig);
- return -1;
- } else {
- printk(KERN_DEBUG DRV_NAME "(chan %d): "
- "queuing txsig (%d) in position %d\n",
- chan->chanpos, txsig, line->txsig_queue_len);
- }
-
spin_lock_irqsave(&line->lock, flags);
- line->txsig_queue[line->txsig_queue_len++] = txsig;
+ line->txsig = txsig;
+ line->txsig_pending = 1;
spin_unlock_irqrestore(&line->lock, flags);
return 0;
}
@@ -216,24 +205,21 @@ static void xivovp_hooksig_pvt(struct xivovp_line* line, enum dahdi_txsig txsig)
}
}
-static void xivovp_handle_txsig_queue(void)
+static void xivovp_handle_txsig(void)
{
static int said;
- int i, j, k;
- enum dahdi_txsig txsig_queue[TXQUEUE_LEN];
+ int i;
+ enum dahdi_txsig txsig;
unsigned long flags;
for (i = 0; i < NB_LINES; i++) {
- if (xivovp.line[i].ready) {
+ if (xivovp.line[i].ready && xivovp.line[i].txsig_pending) {
spin_lock_irqsave(&xivovp.line[i].lock, flags);
- for (j = 0; j < xivovp.line[i].txsig_queue_len; j++)
- txsig_queue[j] = xivovp.line[i].txsig_queue[j];
- xivovp.line[i].txsig_queue_len = 0;
+ txsig = xivovp.line[i].txsig;
+ xivovp.line[i].txsig_pending = 0;
spin_unlock_irqrestore(&xivovp.line[i].lock, flags);
- for (k = 0; k < j; k++)
- xivovp_hooksig_pvt(&xivovp.line[i],
- txsig_queue[k]);
+ xivovp_hooksig_pvt(&xivovp.line[i], txsig);
} else if (!said) {
said = 1;
printk(KERN_WARNING DRV_NAME ": "
@@ -538,7 +524,7 @@ static void vp_tick(const unsigned long data)
}
}
- xivovp_handle_txsig_queue();
+ xivovp_handle_txsig();
if (count_and_stop_traces) {
if (traces_vanish >= 0 && --traces_vanish < 0)