* [patch] mISDN: array underflow in open_bchannel()
@ 2012-03-27 7:20 ` Dan Carpenter
0 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2012-03-27 7:20 UTC (permalink / raw)
To: Karsten Keil; +Cc: David S. Miller, Alexey Dobriyan, netdev, kernel-janitors
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>
diff --git a/drivers/isdn/hardware/mISDN/hfcpci.c b/drivers/isdn/hardware/mISDN/hfcpci.c
index d055ae7..e2c83a2 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;
diff --git a/drivers/isdn/hardware/mISDN/w6692.c b/drivers/isdn/hardware/mISDN/w6692.c
index 7f1e7ba..2183357 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)
{
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;
diff --git a/drivers/isdn/hardware/mISDN/mISDNisar.c b/drivers/isdn/hardware/mISDN/mISDNisar.c
index 10446ab..9a6da6e 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)
{
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;
diff --git a/drivers/isdn/hardware/mISDN/netjet.c b/drivers/isdn/hardware/mISDN/netjet.c
index dd6de9f..c726e09 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)
{
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;
diff --git a/drivers/isdn/hardware/mISDN/avmfritz.c b/drivers/isdn/hardware/mISDN/avmfritz.c
index 05ed4d0c..c0b8c96 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)
{
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;
diff --git a/drivers/isdn/hardware/mISDN/hfcsusb.c b/drivers/isdn/hardware/mISDN/hfcsusb.c
index 6023387..8cde2a0 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)
{
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;
diff --git a/drivers/isdn/hardware/mISDN/mISDNipac.c b/drivers/isdn/hardware/mISDN/mISDNipac.c
index b47e9be..884369f 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)
{
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;
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [patch] mISDN: array underflow in open_bchannel()
@ 2012-03-27 7:20 ` Dan Carpenter
0 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2012-03-27 7:20 UTC (permalink / raw)
To: Karsten Keil; +Cc: David S. Miller, Alexey Dobriyan, netdev, kernel-janitors
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>
diff --git a/drivers/isdn/hardware/mISDN/hfcpci.c b/drivers/isdn/hardware/mISDN/hfcpci.c
index d055ae7..e2c83a2 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;
diff --git a/drivers/isdn/hardware/mISDN/w6692.c b/drivers/isdn/hardware/mISDN/w6692.c
index 7f1e7ba..2183357 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)
{
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;
diff --git a/drivers/isdn/hardware/mISDN/mISDNisar.c b/drivers/isdn/hardware/mISDN/mISDNisar.c
index 10446ab..9a6da6e 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)
{
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;
diff --git a/drivers/isdn/hardware/mISDN/netjet.c b/drivers/isdn/hardware/mISDN/netjet.c
index dd6de9f..c726e09 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)
{
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;
diff --git a/drivers/isdn/hardware/mISDN/avmfritz.c b/drivers/isdn/hardware/mISDN/avmfritz.c
index 05ed4d0c..c0b8c96 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)
{
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;
diff --git a/drivers/isdn/hardware/mISDN/hfcsusb.c b/drivers/isdn/hardware/mISDN/hfcsusb.c
index 6023387..8cde2a0 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)
{
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;
diff --git a/drivers/isdn/hardware/mISDN/mISDNipac.c b/drivers/isdn/hardware/mISDN/mISDNipac.c
index b47e9be..884369f 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)
{
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;
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [patch] mISDN: array underflow in open_bchannel()
2012-03-27 7:20 ` Dan Carpenter
(?)
@ 2012-03-27 7:31 ` walter harms
-1 siblings, 0 replies; 7+ messages in thread
From: walter harms @ 2012-03-27 7:31 UTC (permalink / raw)
To: kernel-janitors
Am 27.03.2012 09:20, schrieb Dan Carpenter:
> 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>
>
> diff --git a/drivers/isdn/hardware/mISDN/hfcpci.c b/drivers/isdn/hardware/mISDN/hfcpci.c
> index d055ae7..e2c83a2 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;
> diff --git a/drivers/isdn/hardware/mISDN/w6692.c b/drivers/isdn/hardware/mISDN/w6692.c
> index 7f1e7ba..2183357 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)
> {
> 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;
> diff --git a/drivers/isdn/hardware/mISDN/mISDNisar.c b/drivers/isdn/hardware/mISDN/mISDNisar.c
> index 10446ab..9a6da6e 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)
> {
> 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;
> diff --git a/drivers/isdn/hardware/mISDN/netjet.c b/drivers/isdn/hardware/mISDN/netjet.c
> index dd6de9f..c726e09 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)
> {
> 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;
> diff --git a/drivers/isdn/hardware/mISDN/avmfritz.c b/drivers/isdn/hardware/mISDN/avmfritz.c
> index 05ed4d0c..c0b8c96 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)
> {
> 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;
> diff --git a/drivers/isdn/hardware/mISDN/hfcsusb.c b/drivers/isdn/hardware/mISDN/hfcsusb.c
> index 6023387..8cde2a0 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)
> {
> 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;
> diff --git a/drivers/isdn/hardware/mISDN/mISDNipac.c b/drivers/isdn/hardware/mISDN/mISDNipac.c
> index b47e9be..884369f 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)
> {
> 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch] mISDN: array underflow in open_bchannel()
2012-03-27 7:20 ` Dan Carpenter
(?)
(?)
@ 2012-03-27 7:39 ` Dan Carpenter
-1 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2012-03-27 7:39 UTC (permalink / raw)
To: kernel-janitors
On Tue, Mar 27, 2012 at 09:31:45AM +0200, walter harms wrote:
>
> hi dan,
> short question: is is possible to make rq->adr.channel unsigned ?
>
It is unsigned. It's a u8.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch] mISDN: array underflow in open_bchannel()
2012-03-27 7:20 ` Dan Carpenter
` (2 preceding siblings ...)
(?)
@ 2012-03-27 7:44 ` walter harms
-1 siblings, 0 replies; 7+ messages in thread
From: walter harms @ 2012-03-27 7:44 UTC (permalink / raw)
To: kernel-janitors
Am 27.03.2012 09:39, schrieb Dan Carpenter:
> On Tue, Mar 27, 2012 at 09:31:45AM +0200, walter harms wrote:
>>
>> hi dan,
>> short question: is is possible to make rq->adr.channel unsigned ?
>>
>
> 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch] mISDN: array underflow in open_bchannel()
2012-03-27 7:20 ` Dan Carpenter
@ 2012-03-28 2:42 ` David Miller
-1 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2012-03-28 2:42 UTC (permalink / raw)
To: dan.carpenter; +Cc: isdn, adobriyan, netdev, kernel-janitors
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Tue, 27 Mar 2012 10:20:48 +0300
> 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>
Applied, thanks Dan.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch] mISDN: array underflow in open_bchannel()
@ 2012-03-28 2:42 ` David Miller
0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2012-03-28 2:42 UTC (permalink / raw)
To: dan.carpenter; +Cc: isdn, adobriyan, netdev, kernel-janitors
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Tue, 27 Mar 2012 10:20:48 +0300
> 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>
Applied, thanks Dan.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-03-28 2:42 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-27 7:20 [patch] mISDN: array underflow in open_bchannel() Dan Carpenter
2012-03-27 7:20 ` Dan Carpenter
2012-03-27 7:31 ` walter harms
2012-03-27 7:39 ` Dan Carpenter
2012-03-27 7:44 ` walter harms
2012-03-28 2:42 ` David Miller
2012-03-28 2:42 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.