mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 5/7] gadget: possible null pointer dereference fix
@ 2013-03-12 16:05 Renaud C.
  2013-03-13 10:32 ` Cerrato Renaud
  0 siblings, 1 reply; 2+ messages in thread
From: Renaud C. @ 2013-03-12 16:05 UTC (permalink / raw)
  To: barebox


[-- Attachment #1.1: Type: text/plain, Size: 109 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 163 bytes --]

[-- Attachment #2: gadget-null-pointer-dereference-fix.patch --]
[-- Type: application/octet-stream, Size: 1215 bytes --]

From 37b7dc7f2232b54f8fc8a5590245af37fe7d8299 Mon Sep 17 00:00:00 2001
From: Cerrato Renaud <r.cerrato@til-technologies.fr>
Date: Thu, 28 Feb 2013 15:04:53 +0100
Subject: [PATCH 3/3] null pointer dereference fix

---
 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


[-- Attachment #3: Type: text/plain, Size: 149 bytes --]

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

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

* Re: [PATCH 5/7] gadget: possible null pointer dereference fix
  2013-03-12 16:05 [PATCH 5/7] gadget: possible null pointer dereference fix Renaud C.
@ 2013-03-13 10:32 ` Cerrato Renaud
  0 siblings, 0 replies; 2+ messages in thread
From: Cerrato Renaud @ 2013-03-13 10:32 UTC (permalink / raw)
  To: barebox

Inlined patch below.


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


On 12/03/2013 17:05, Renaud C. wrote:
> This patch fix a possible null pointer dereference exception because of a missing null check on cdev->config
>
>
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox



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

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-12 16:05 [PATCH 5/7] gadget: possible null pointer dereference fix Renaud C.
2013-03-13 10:32 ` Cerrato Renaud

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