summaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hardware/mISDN/hfcpci.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2012-03-26 23:20:48 +0200
committerDavid S. Miller <davem@davemloft.net>2012-03-28 04:42:32 +0200
commit819a100846295461bc0f1bfcb8e5ab11c1bc4cdb (patch)
tree60a01beefe73812d91e6459bcfa0cccd54ea2e59 /drivers/isdn/hardware/mISDN/hfcpci.c
parentbnx2x: fix vector traveling while looking for an empty entry (diff)
downloadlinux-819a100846295461bc0f1bfcb8e5ab11c1bc4cdb.tar.xz
linux-819a100846295461bc0f1bfcb8e5ab11c1bc4cdb.zip
mISDN: array underflow in open_bchannel()
There are two channels here. User space starts counting channels at one but in the kernel we start at zero. If the user passes in a zero channel that's invalid and could lead to memory corruption. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn/hardware/mISDN/hfcpci.c')
-rw-r--r--drivers/isdn/hardware/mISDN/hfcpci.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/isdn/hardware/mISDN/hfcpci.c b/drivers/isdn/hardware/mISDN/hfcpci.c
index d055ae7fa040..e2c83a2d7691 100644
--- a/drivers/isdn/hardware/mISDN/hfcpci.c
+++ b/drivers/isdn/hardware/mISDN/hfcpci.c
@@ -1962,7 +1962,7 @@ open_bchannel(struct hfc_pci *hc, struct channel_req *rq)
{
struct bchannel *bch;
- if (rq->adr.channel > 2)
+ if (rq->adr.channel == 0 || rq->adr.channel > 2)
return -EINVAL;
if (rq->protocol == ISDN_P_NONE)
return -EINVAL;