diff options
| author | Alexandre Bounine <alexandre.bounine@idt.com> | 2012-03-05 17:59:21 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-05 18:49:43 -0500 |
| commit | b24823e61bfd93d0e72088e4f5245287582ed289 (patch) | |
| tree | bca721d4235a676cd4cfbfc0d467c9bce5b39fc2 /drivers/rapidio/devices | |
| parent | e6ca7b89dc76abf77c80887fed54e0a60c87c0a8 (diff) | |
rapidio/tsi721: fix queue wrapping bug in inbound doorbell handler
Fix a bug that causes a kernel panic when the number of received doorbells
is larger than number of entries in the inbound doorbell queue (current
default value = 512).
Another possible indication for this bug is large number of spurious
doorbells reported by tsi721 driver after reaching the queue size maximum.
Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Cc: Chul Kim <chul.kim@idt.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: <stable@vger.kernel.org> [3.2.x+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rapidio/devices')
| -rw-r--r-- | drivers/rapidio/devices/tsi721.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/rapidio/devices/tsi721.c b/drivers/rapidio/devices/tsi721.c index 691b1ab1a3d0..30d2072f480b 100644 --- a/drivers/rapidio/devices/tsi721.c +++ b/drivers/rapidio/devices/tsi721.c | |||
| @@ -410,13 +410,14 @@ static void tsi721_db_dpc(struct work_struct *work) | |||
| 410 | */ | 410 | */ |
| 411 | mport = priv->mport; | 411 | mport = priv->mport; |
| 412 | 412 | ||
| 413 | wr_ptr = ioread32(priv->regs + TSI721_IDQ_WP(IDB_QUEUE)); | 413 | wr_ptr = ioread32(priv->regs + TSI721_IDQ_WP(IDB_QUEUE)) % IDB_QSIZE; |
| 414 | rd_ptr = ioread32(priv->regs + TSI721_IDQ_RP(IDB_QUEUE)); | 414 | rd_ptr = ioread32(priv->regs + TSI721_IDQ_RP(IDB_QUEUE)) % IDB_QSIZE; |
| 415 | 415 | ||
| 416 | while (wr_ptr != rd_ptr) { | 416 | while (wr_ptr != rd_ptr) { |
| 417 | idb_entry = (u64 *)(priv->idb_base + | 417 | idb_entry = (u64 *)(priv->idb_base + |
| 418 | (TSI721_IDB_ENTRY_SIZE * rd_ptr)); | 418 | (TSI721_IDB_ENTRY_SIZE * rd_ptr)); |
| 419 | rd_ptr++; | 419 | rd_ptr++; |
| 420 | rd_ptr %= IDB_QSIZE; | ||
| 420 | idb.msg = *idb_entry; | 421 | idb.msg = *idb_entry; |
| 421 | *idb_entry = 0; | 422 | *idb_entry = 0; |
| 422 | 423 | ||
