mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 4/5] gadget: possible null pointer dereference fix
@ 2013-03-13 13:44 Cerrato Renaud
  2013-03-14  7:35 ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: Cerrato Renaud @ 2013-03-13 13:44 UTC (permalink / raw)
  To: barebox

This patch fix a possible null pointer dereference exception because of a missing null check on cdev->config

Signed-off-by: Cerrato Renaud <r.cerrato@til-technologies.fr>
---
 drivers/usb/gadget/composite.c |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 9af115e..1f6c5b2 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -777,18 +777,21 @@ unknown:
          * recipients (endpoint, other, WUSB, ...) to the current
          * configuration code.
          */
-        f = cdev->config->interface[intf];
-        if (f && f->setup)
-            value = f->setup(f, ctrl);
-        else
-            f = NULL;
+        if(cdev->config) {
 
-        if (value < 0 && !f) {
-            struct usb_configuration    *c;
+            f = cdev->config->interface[intf];
+            if (f && f->setup)
+                value = f->setup(f, ctrl);
+            else
+                f = NULL;
 
-            c = cdev->config;
-            if (c && c->setup)
-                value = c->setup(c, ctrl);
+            if (value < 0 && !f) {
+                struct usb_configuration    *c;
+
+                c = cdev->config;
+                if (c && c->setup)
+                    value = c->setup(c, ctrl);
+            }
         }
 
         goto done;
-- 
1.7.2.5


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 4/5] gadget: possible null pointer dereference fix
  2013-03-13 13:44 [PATCH 4/5] gadget: possible null pointer dereference fix Cerrato Renaud
@ 2013-03-14  7:35 ` Sascha Hauer
  2013-03-14 10:01   ` Cerrato Renaud
  0 siblings, 1 reply; 4+ messages in thread
From: Sascha Hauer @ 2013-03-14  7:35 UTC (permalink / raw)
  To: Cerrato Renaud; +Cc: barebox

On Wed, Mar 13, 2013 at 02:44:39PM +0100, Cerrato Renaud wrote:
> This patch fix a possible null pointer dereference exception because of a missing null check on cdev->config
> 
> Signed-off-by: Cerrato Renaud <r.cerrato@til-technologies.fr>
> ---
>  drivers/usb/gadget/composite.c |   23 +++++++++++++----------
>  1 files changed, 13 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
> index 9af115e..1f6c5b2 100644
> --- a/drivers/usb/gadget/composite.c
> +++ b/drivers/usb/gadget/composite.c
> @@ -777,18 +777,21 @@ unknown:
>           * recipients (endpoint, other, WUSB, ...) to the current
>           * configuration code.
>           */
> -        f = cdev->config->interface[intf];
> -        if (f && f->setup)
> -            value = f->setup(f, ctrl);
> -        else
> -            f = NULL;
> +        if(cdev->config) {

please do a:

	if (!cdev->config)
		goto out;

instead.

Your patch is whitespace damaged, I won't be able to apply it.
As Jean-Christophe mentioned, you should use git-send-mail for sending
your patches. It does things just right.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 4/5] gadget: possible null pointer dereference fix
  2013-03-14  7:35 ` Sascha Hauer
@ 2013-03-14 10:01   ` Cerrato Renaud
  2013-03-14 10:34     ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: Cerrato Renaud @ 2013-03-14 10:01 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

For some reasons relative to my company , I'm not able to send emails 
using git-send-email. I gave up.
Thanks.

On jeudi 14 mars 2013 08:35:41, Sascha Hauer wrote:
> On Wed, Mar 13, 2013 at 02:44:39PM +0100, Cerrato Renaud wrote:
>> This patch fix a possible null pointer dereference exception because of a missing null check on cdev->config
>>
>> Signed-off-by: Cerrato Renaud <r.cerrato@til-technologies.fr>
>> ---
>>  drivers/usb/gadget/composite.c |   23 +++++++++++++----------
>>  1 files changed, 13 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
>> index 9af115e..1f6c5b2 100644
>> --- a/drivers/usb/gadget/composite.c
>> +++ b/drivers/usb/gadget/composite.c
>> @@ -777,18 +777,21 @@ unknown:
>>           * recipients (endpoint, other, WUSB, ...) to the current
>>           * configuration code.
>>           */
>> -        f = cdev->config->interface[intf];
>> -        if (f && f->setup)
>> -            value = f->setup(f, ctrl);
>> -        else
>> -            f = NULL;
>> +        if(cdev->config) {
>
> please do a:
>
> 	if (!cdev->config)
> 		goto out;
>
> instead.
>
> Your patch is whitespace damaged, I won't be able to apply it.
> As Jean-Christophe mentioned, you should use git-send-mail for sending
> your patches. It does things just right.
>
> Sascha
>




_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 4/5] gadget: possible null pointer dereference fix
  2013-03-14 10:01   ` Cerrato Renaud
@ 2013-03-14 10:34     ` Sascha Hauer
  0 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2013-03-14 10:34 UTC (permalink / raw)
  To: Cerrato Renaud; +Cc: barebox

On Thu, Mar 14, 2013 at 11:01:31AM +0100, Cerrato Renaud wrote:
> For some reasons relative to my company , I'm not able to send emails 
> using git-send-email. I gave up.

What a pitty.

I know getting the tools right for sending patches can be quite a high
barrier sometimes. Most other Open Source projects will require the same
if you want to participate, so I think it's really worth it to set this
up, if it's not for barebox then it might be for the Kernel or whatever
project you might be interested in.

Most other people in your situation setup a Gmail account and end up
sending mails from home if necessary until they can put enough pressure
on their administrators.

Sorry, I don't like loosing useful contributions, but on the other hand
our workflow depends on being able to review and apply patches quickly.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-03-14 10:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-13 13:44 [PATCH 4/5] gadget: possible null pointer dereference fix Cerrato Renaud
2013-03-14  7:35 ` Sascha Hauer
2013-03-14 10:01   ` Cerrato Renaud
2013-03-14 10:34     ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox