diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2012-03-26 17:20:48 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-03-27 22:42:32 -0400 |
commit | 819a100846295461bc0f1bfcb8e5ab11c1bc4cdb (patch) | |
tree | 60a01beefe73812d91e6459bcfa0cccd54ea2e59 /drivers/isdn | |
parent | c54e9bd38a06babf94fd45e5f1df9a1109e12818 (diff) |
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')
-rw-r--r-- | drivers/isdn/hardware/mISDN/avmfritz.c | 2 | ||||
-rw-r--r-- | drivers/isdn/hardware/mISDN/hfcpci.c | 2 | ||||
-rw-r--r-- | drivers/isdn/hardware/mISDN/hfcsusb.c | 2 | ||||
-rw-r--r-- | drivers/isdn/hardware/mISDN/mISDNipac.c | 2 | ||||
-rw-r--r-- | drivers/isdn/hardware/mISDN/mISDNisar.c | 2 | ||||
-rw-r--r-- | drivers/isdn/hardware/mISDN/netjet.c | 2 | ||||
-rw-r--r-- | drivers/isdn/hardware/mISDN/w6692.c | 2 |
7 files changed, 7 insertions, 7 deletions
diff --git a/drivers/isdn/hardware/mISDN/avmfritz.c b/drivers/isdn/hardware/mISDN/avmfritz.c index 05ed4d0cb18b..c0b8c960ee3f 100644 --- a/drivers/isdn/hardware/mISDN/avmfritz.c +++ b/drivers/isdn/hardware/mISDN/avmfritz.c | |||
@@ -891,7 +891,7 @@ open_bchannel(struct fritzcard *fc, struct channel_req *rq) | |||
891 | { | 891 | { |
892 | struct bchannel *bch; | 892 | struct bchannel *bch; |
893 | 893 | ||
894 | if (rq->adr.channel > 2) | 894 | if (rq->adr.channel == 0 || rq->adr.channel > 2) |
895 | return -EINVAL; | 895 | return -EINVAL; |
896 | if (rq->protocol == ISDN_P_NONE) | 896 | if (rq->protocol == ISDN_P_NONE) |
897 | return -EINVAL; | 897 | return -EINVAL; |
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) | |||
1962 | { | 1962 | { |
1963 | struct bchannel *bch; | 1963 | struct bchannel *bch; |
1964 | 1964 | ||
1965 | if (rq->adr.channel > 2) | 1965 | if (rq->adr.channel == 0 || rq->adr.channel > 2) |
1966 | return -EINVAL; | 1966 | return -EINVAL; |
1967 | if (rq->protocol == ISDN_P_NONE) | 1967 | if (rq->protocol == ISDN_P_NONE) |
1968 | return -EINVAL; | 1968 | return -EINVAL; |
diff --git a/drivers/isdn/hardware/mISDN/hfcsusb.c b/drivers/isdn/hardware/mISDN/hfcsusb.c index 602338734634..8cde2a0538ab 100644 --- a/drivers/isdn/hardware/mISDN/hfcsusb.c +++ b/drivers/isdn/hardware/mISDN/hfcsusb.c | |||
@@ -486,7 +486,7 @@ open_bchannel(struct hfcsusb *hw, struct channel_req *rq) | |||
486 | { | 486 | { |
487 | struct bchannel *bch; | 487 | struct bchannel *bch; |
488 | 488 | ||
489 | if (rq->adr.channel > 2) | 489 | if (rq->adr.channel == 0 || rq->adr.channel > 2) |
490 | return -EINVAL; | 490 | return -EINVAL; |
491 | if (rq->protocol == ISDN_P_NONE) | 491 | if (rq->protocol == ISDN_P_NONE) |
492 | return -EINVAL; | 492 | return -EINVAL; |
diff --git a/drivers/isdn/hardware/mISDN/mISDNipac.c b/drivers/isdn/hardware/mISDN/mISDNipac.c index b47e9bed2185..884369f09cad 100644 --- a/drivers/isdn/hardware/mISDN/mISDNipac.c +++ b/drivers/isdn/hardware/mISDN/mISDNipac.c | |||
@@ -1506,7 +1506,7 @@ open_bchannel(struct ipac_hw *ipac, struct channel_req *rq) | |||
1506 | { | 1506 | { |
1507 | struct bchannel *bch; | 1507 | struct bchannel *bch; |
1508 | 1508 | ||
1509 | if (rq->adr.channel > 2) | 1509 | if (rq->adr.channel == 0 || rq->adr.channel > 2) |
1510 | return -EINVAL; | 1510 | return -EINVAL; |
1511 | if (rq->protocol == ISDN_P_NONE) | 1511 | if (rq->protocol == ISDN_P_NONE) |
1512 | return -EINVAL; | 1512 | return -EINVAL; |
diff --git a/drivers/isdn/hardware/mISDN/mISDNisar.c b/drivers/isdn/hardware/mISDN/mISDNisar.c index 10446ab404b5..9a6da6edcfa8 100644 --- a/drivers/isdn/hardware/mISDN/mISDNisar.c +++ b/drivers/isdn/hardware/mISDN/mISDNisar.c | |||
@@ -1670,7 +1670,7 @@ isar_open(struct isar_hw *isar, struct channel_req *rq) | |||
1670 | { | 1670 | { |
1671 | struct bchannel *bch; | 1671 | struct bchannel *bch; |
1672 | 1672 | ||
1673 | if (rq->adr.channel > 2) | 1673 | if (rq->adr.channel == 0 || rq->adr.channel > 2) |
1674 | return -EINVAL; | 1674 | return -EINVAL; |
1675 | if (rq->protocol == ISDN_P_NONE) | 1675 | if (rq->protocol == ISDN_P_NONE) |
1676 | return -EINVAL; | 1676 | return -EINVAL; |
diff --git a/drivers/isdn/hardware/mISDN/netjet.c b/drivers/isdn/hardware/mISDN/netjet.c index dd6de9f7a8a3..c726e09d0981 100644 --- a/drivers/isdn/hardware/mISDN/netjet.c +++ b/drivers/isdn/hardware/mISDN/netjet.c | |||
@@ -860,7 +860,7 @@ open_bchannel(struct tiger_hw *card, struct channel_req *rq) | |||
860 | { | 860 | { |
861 | struct bchannel *bch; | 861 | struct bchannel *bch; |
862 | 862 | ||
863 | if (rq->adr.channel > 2) | 863 | if (rq->adr.channel == 0 || rq->adr.channel > 2) |
864 | return -EINVAL; | 864 | return -EINVAL; |
865 | if (rq->protocol == ISDN_P_NONE) | 865 | if (rq->protocol == ISDN_P_NONE) |
866 | return -EINVAL; | 866 | return -EINVAL; |
diff --git a/drivers/isdn/hardware/mISDN/w6692.c b/drivers/isdn/hardware/mISDN/w6692.c index 7f1e7ba75cd1..2183357f0799 100644 --- a/drivers/isdn/hardware/mISDN/w6692.c +++ b/drivers/isdn/hardware/mISDN/w6692.c | |||
@@ -1015,7 +1015,7 @@ open_bchannel(struct w6692_hw *card, struct channel_req *rq) | |||
1015 | { | 1015 | { |
1016 | struct bchannel *bch; | 1016 | struct bchannel *bch; |
1017 | 1017 | ||
1018 | if (rq->adr.channel > 2) | 1018 | if (rq->adr.channel == 0 || rq->adr.channel > 2) |
1019 | return -EINVAL; | 1019 | return -EINVAL; |
1020 | if (rq->protocol == ISDN_P_NONE) | 1020 | if (rq->protocol == ISDN_P_NONE) |
1021 | return -EINVAL; | 1021 | return -EINVAL; |