mISDN: array underflow in open_bchannel()
Subsystems (3)
PATCH 1/1 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.
drivers/isdn/hardware/mISDN/hfcpci.c +1 -1
@@ -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 ;
drivers/isdn/hardware/mISDN/w6692.c +1 -1
@@ -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 ;
drivers/isdn/hardware/mISDN/mISDNisar.c +1 -1
@@ -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 ;
drivers/isdn/hardware/mISDN/netjet.c +1 -1
@@ -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 ;
drivers/isdn/hardware/mISDN/avmfritz.c +1 -1
@@ -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 ;
drivers/isdn/hardware/mISDN/hfcsusb.c +1 -1
@@ -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 ;
drivers/isdn/hardware/mISDN/mISDNipac.c +1 -1
@@ -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 ;
Am 27.03.2012 09:20, schrieb Dan Carpenter:
Quoted 89 lines
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 <[email protected]>drivers/isdn/hardware/mISDN/hfcpci.c +1
-1@@ -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 ;drivers/isdn/hardware/mISDN/w6692.c +1
-1@@ -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 ;drivers/isdn/hardware/mISDN/mISDNisar.c +1
-1@@ -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 ;drivers/isdn/hardware/mISDN/netjet.c +1
-1@@ -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 ;drivers/isdn/hardware/mISDN/avmfritz.c +1
-1@@ -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 ;drivers/isdn/hardware/mISDN/hfcsusb.c +1
-1@@ -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 ;drivers/isdn/hardware/mISDN/mISDNipac.c +0
-0
drivers/isdn/hardware/mISDN/mISDNipac.c open_bchannel(struct ipac_hw *ipac, struct channel_req *rq) · line 1512
Quoted 8 lines
drivers/isdn/hardware/mISDN/mISDNipac.c +1
-1@@ -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 ;
hi dan,
short question: is is possible to make rq->adr.channel unsigned ?
re,
wh
Quoted 4 lines · walter harms
hi dan,
short question: is is possible to makerq->adr.channelunsigned ?
It is unsigned. It's a u8.
regards,
dan carpenter
Am 27.03.2012 09:39, schrieb Dan Carpenter:
Quoted 10 lines · walter harms
Quoted 4 lines
hi dan,
short question: is is possible to makerq->adr.channelunsigned ?It is unsigned. It's a u8.
i am still sleeping ... i did not see that you are checking x = 0 i was seeing x<0 sorry for the noise.
re,
wh
From: Dan Carpenter <[email protected]>
Date: Tue, 27 Mar 2012 10:20:48 +0300
Quoted 5 lines
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 <[email protected]>
Applied, thanks Dan.