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

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