* [patch] rapidio: potential null deref on failure path
@ 2011-03-19 4:40 Dan Carpenter
2011-03-21 12:49 ` Bounine, Alexandre
2011-03-21 18:34 ` Bounine, Alexandre
0 siblings, 2 replies; 7+ messages in thread
From: Dan Carpenter @ 2011-03-19 4:40 UTC (permalink / raw)
To: Matt Porter; +Cc: Alexandre Bounine, linux-kernel, kernel-janitors
If rio is not a switch then "rswitch" is null.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c
index a50391b..3a59d5f 100644
--- a/drivers/rapidio/rio-scan.c
+++ b/drivers/rapidio/rio-scan.c
@@ -517,7 +517,7 @@ static struct rio_dev __devinit *rio_setup_device(struct rio_net *net,
return rdev;
cleanup:
- if (rswitch->route_table)
+ if (rio_is_switch(rdev))
kfree(rswitch->route_table);
kfree(rdev);
^ permalink raw reply related [flat|nested] 7+ messages in thread
* RE: [patch] rapidio: potential null deref on failure path
2011-03-19 4:40 [patch] rapidio: potential null deref on failure path Dan Carpenter
@ 2011-03-21 12:49 ` Bounine, Alexandre
2011-03-21 14:59 ` Dan Carpenter
2011-03-21 18:34 ` Bounine, Alexandre
1 sibling, 1 reply; 7+ messages in thread
From: Bounine, Alexandre @ 2011-03-21 12:49 UTC (permalink / raw)
To: Dan Carpenter, Matt Porter; +Cc: linux-kernel, kernel-janitors
Better to combine both conditions:
if (rio_is_switch(rdev) && rswitch->route_table))
kfree(rswitch->route_table);
Because there is situation when routine fails to allocate route_table
for a switch.
Alex.
-----Original Message-----
From: Dan Carpenter [mailto:error27@gmail.com]
Sent: Saturday, March 19, 2011 12:41 AM
To: Matt Porter
Cc: Bounine, Alexandre; linux-kernel@vger.kernel.org;
kernel-janitors@vger.kernel.org
Subject: [patch] rapidio: potential null deref on failure path
If rio is not a switch then "rswitch" is null.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c
index a50391b..3a59d5f 100644
--- a/drivers/rapidio/rio-scan.c
+++ b/drivers/rapidio/rio-scan.c
@@ -517,7 +517,7 @@ static struct rio_dev __devinit
*rio_setup_device(struct rio_net *net,
return rdev;
cleanup:
- if (rswitch->route_table)
+ if (rio_is_switch(rdev))
kfree(rswitch->route_table);
kfree(rdev);
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [patch] rapidio: potential null deref on failure path
2011-03-21 12:49 ` Bounine, Alexandre
@ 2011-03-21 14:59 ` Dan Carpenter
2011-03-21 15:15 ` Bounine, Alexandre
0 siblings, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2011-03-21 14:59 UTC (permalink / raw)
To: Bounine, Alexandre; +Cc: Matt Porter, linux-kernel, kernel-janitors
On Mon, Mar 21, 2011 at 05:49:06AM -0700, Bounine, Alexandre wrote:
> Better to combine both conditions:
>
> if (rio_is_switch(rdev) && rswitch->route_table))
> kfree(rswitch->route_table);
>
> Because there is situation when routine fails to allocate route_table
> for a switch.
>
kfree() accepts NULL pointers. People have been removing these checks
all over the tree by the hundreds... Sorry I should have mentioned
that.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [patch] rapidio: potential null deref on failure path
2011-03-21 14:59 ` Dan Carpenter
@ 2011-03-21 15:15 ` Bounine, Alexandre
2011-03-21 15:52 ` Dan Carpenter
0 siblings, 1 reply; 7+ messages in thread
From: Bounine, Alexandre @ 2011-03-21 15:15 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Matt Porter, linux-kernel, kernel-janitors
In this case I agree.
Do you want me to move this patch up or you have your own path for it?
Alex.
-----Original Message-----
From: Dan Carpenter [mailto:error27@gmail.com]
Sent: Monday, March 21, 2011 11:00 AM
To: Bounine, Alexandre
Cc: Matt Porter; linux-kernel@vger.kernel.org;
kernel-janitors@vger.kernel.org
Subject: Re: [patch] rapidio: potential null deref on failure path
On Mon, Mar 21, 2011 at 05:49:06AM -0700, Bounine, Alexandre wrote:
> Better to combine both conditions:
>
> if (rio_is_switch(rdev) && rswitch->route_table))
> kfree(rswitch->route_table);
>
> Because there is situation when routine fails to allocate route_table
> for a switch.
>
kfree() accepts NULL pointers. People have been removing these checks
all over the tree by the hundreds... Sorry I should have mentioned
that.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch] rapidio: potential null deref on failure path
2011-03-21 15:15 ` Bounine, Alexandre
@ 2011-03-21 15:52 ` Dan Carpenter
2011-03-21 16:05 ` Bounine, Alexandre
0 siblings, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2011-03-21 15:52 UTC (permalink / raw)
To: Bounine, Alexandre; +Cc: Matt Porter, linux-kernel, kernel-janitors
On Mon, Mar 21, 2011 at 08:15:33AM -0700, Bounine, Alexandre wrote:
> In this case I agree.
> Do you want me to move this patch up or you have your own path for it?
>
Could you take it, please?
regards,
dan carpenter
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [patch] rapidio: potential null deref on failure path
2011-03-21 15:52 ` Dan Carpenter
@ 2011-03-21 16:05 ` Bounine, Alexandre
0 siblings, 0 replies; 7+ messages in thread
From: Bounine, Alexandre @ 2011-03-21 16:05 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Matt Porter, linux-kernel, kernel-janitors
No problem.
-----Original Message-----
From: Dan Carpenter [mailto:error27@gmail.com]
Sent: Monday, March 21, 2011 11:52 AM
To: Bounine, Alexandre
Cc: Matt Porter; linux-kernel@vger.kernel.org;
kernel-janitors@vger.kernel.org
Subject: Re: [patch] rapidio: potential null deref on failure path
On Mon, Mar 21, 2011 at 08:15:33AM -0700, Bounine, Alexandre wrote:
> In this case I agree.
> Do you want me to move this patch up or you have your own path for it?
>
Could you take it, please?
regards,
dan carpenter
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [patch] rapidio: potential null deref on failure path
2011-03-19 4:40 [patch] rapidio: potential null deref on failure path Dan Carpenter
2011-03-21 12:49 ` Bounine, Alexandre
@ 2011-03-21 18:34 ` Bounine, Alexandre
1 sibling, 0 replies; 7+ messages in thread
From: Bounine, Alexandre @ 2011-03-21 18:34 UTC (permalink / raw)
To: Dan Carpenter, Matt Porter; +Cc: linux-kernel, kernel-janitors
> From: Dan Carpenter [mailto:error27@gmail.com]
> Sent: Saturday, March 19, 2011 12:41 AM
> To: Matt Porter
> Cc: Bounine, Alexandre; linux-kernel@vger.kernel.org; kernel-
> janitors@vger.kernel.org
> Subject: [patch] rapidio: potential null deref on failure path
>
> If rio is not a switch then "rswitch" is null.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
>
> diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c
> index a50391b..3a59d5f 100644
> --- a/drivers/rapidio/rio-scan.c
> +++ b/drivers/rapidio/rio-scan.c
> @@ -517,7 +517,7 @@ static struct rio_dev __devinit
> *rio_setup_device(struct rio_net *net,
> return rdev;
>
> cleanup:
> - if (rswitch->route_table)
> + if (rio_is_switch(rdev))
> kfree(rswitch->route_table);
>
> kfree(rdev);
Acked-by: Alexandre Bounine <alexandre.bounine@idt.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-03-21 18:35 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-19 4:40 [patch] rapidio: potential null deref on failure path Dan Carpenter
2011-03-21 12:49 ` Bounine, Alexandre
2011-03-21 14:59 ` Dan Carpenter
2011-03-21 15:15 ` Bounine, Alexandre
2011-03-21 15:52 ` Dan Carpenter
2011-03-21 16:05 ` Bounine, Alexandre
2011-03-21 18:34 ` Bounine, Alexandre
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).