diff options
author | Eli Billauer <eli.billauer@gmail.com> | 2014-07-05 12:45:07 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-07-09 12:19:37 -0700 |
commit | cc6289fa1469831b806f2a857a19169d15759c31 (patch) | |
tree | f7d01a062a20412c85274fab7deed294ab9c48c6 /drivers/staging/xillybus | |
parent | 1f765d9f4cfca6ef77dd19a0e48590324e579c72 (diff) |
staging: xillybus: Add sanity check in interrupt handler
Data arriving from the hardware is verified prior to its use. The lack of
this check has never been reported to cause a problem, but it's necessary
nevertheless.
Signed-off-by: Eli Billauer <eli.billauer@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/xillybus')
-rw-r--r-- | drivers/staging/xillybus/xillybus_core.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/staging/xillybus/xillybus_core.c b/drivers/staging/xillybus/xillybus_core.c index 5fca58e4e082..fa799795f714 100644 --- a/drivers/staging/xillybus/xillybus_core.c +++ b/drivers/staging/xillybus/xillybus_core.c @@ -267,6 +267,12 @@ irqreturn_t xillybus_isr(int irq, void *data) break; case XILLYMSG_OPCODE_FIFOEOF: + if ((msg_channel > ep->num_channels) || + (msg_channel == 0) || (!msg_dir) || + !ep->channels[msg_channel]->num_wr_buffers) { + malformed_message(ep, &buf[i]); + break; + } channel = ep->channels[msg_channel]; spin_lock(&channel->wr_spinlock); channel->wr_eof = msg_bufno; |