]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
mISDN: array underflow in open_bchannel()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 26 Mar 2012 21:20:48 +0000 (21:20 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 28 Mar 2012 02:42:32 +0000 (22:42 -0400)
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>
drivers/isdn/hardware/mISDN/avmfritz.c
drivers/isdn/hardware/mISDN/hfcpci.c
drivers/isdn/hardware/mISDN/hfcsusb.c
drivers/isdn/hardware/mISDN/mISDNipac.c
drivers/isdn/hardware/mISDN/mISDNisar.c
drivers/isdn/hardware/mISDN/netjet.c
drivers/isdn/hardware/mISDN/w6692.c

index 05ed4d0cb18b0e0195bbceae9fc4d6fea8956a0b..c0b8c960ee3f7f115c6a5cd9ca3a7469b3185f3b 100644 (file)
@@ -891,7 +891,7 @@ open_bchannel(struct fritzcard *fc, 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;
index d055ae7fa040ff80fb77841e94e15d66575505ba..e2c83a2d76910629fc319d506af8735b323d080a 100644 (file)
@@ -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;
index 602338734634e184f50d8952911fa1d68d1cb9fd..8cde2a0538ab862f65b36411d4c3f06d2e0ec45e 100644 (file)
@@ -486,7 +486,7 @@ open_bchannel(struct hfcsusb *hw, 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;
index b47e9bed2185a5c944ce7d25b473ed816d560418..884369f09cad1e3dbd519a8ea392227e4c2b0fce 100644 (file)
@@ -1506,7 +1506,7 @@ open_bchannel(struct ipac_hw *ipac, 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;
index 10446ab404b55e48eb98be5b525ece01864db524..9a6da6edcfa899c99f62c140af7fe48223ce44cc 100644 (file)
@@ -1670,7 +1670,7 @@ isar_open(struct isar_hw *isar, 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;
index dd6de9f7a8a34ed0dd4f808c3b1a9f6783edc442..c726e09d0981bafc8ee3c1d2680a1e83326422c0 100644 (file)
@@ -860,7 +860,7 @@ open_bchannel(struct tiger_hw *card, 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;
index 7f1e7ba75cd10c149d57c85551c54c02d3ee3db7..2183357f079948fe7590df8c095289329c231748 100644 (file)
@@ -1015,7 +1015,7 @@ open_bchannel(struct w6692_hw *card, 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;