Re: [PATCH] USB: gadget: g_fs: possible invalid pointer reference bugfixed

From: MichaÅ Nazarewicz
Date: Wed Jun 16 2010 - 05:29:28 EST


Michal Nazarewicz wrote:
diff --git a/drivers/usb/gadget/g_ffs.c b/drivers/usb/gadget/g_ffs.c
index 2f26470..da3a9e4 100644
--- a/drivers/usb/gadget/g_ffs.c
+++ b/drivers/usb/gadget/g_ffs.c
@@ -392,6 +392,17 @@ static int __gfs_do_config(struct usb_configuration *c,
if (unlikely(ret < 0))
return ret;

+ /* After previous do_configs there may be some invalid
+ * pointers in c->interface array. This happens every time
+ * a user space function with fewer interfaces than a user
+ * space function that was run before the new one is run. The
+ * compasit's set_config() assumes that if there is no more
+ * then MAX_CONFIG_INTERFACES interfaces in a configuration
+ * then there is a NULL pointer after the last interface in
+ * c->interface array. We need to make sure this is true. */

On Tue, 15 Jun 2010 12:10:36 +0200, Sergei Shtylyov <sshtylyov@xxxxxxxxxx> wrote:
According to CodingStyle, the preferred style of the multi-line comments
is this:

/*
* bla
* bla
*/

You are of course correct but on the other hand I have consistently used
the incorrect form so far also in g_ffs.c so... I think correcting only
this comment would bring inconsistency so I should rather resend it with
other (two) comments corrected as well. Anyone thinks I should do that?

And I promise, I will remember to use the correct format in my future
files.

--
Best regards, _ _
| Humble Liege of Serenely Enlightened Majesty of o' \,=./ `o
| Computer Science, MichaÅ "mina86" Nazarewicz (o o)
+----[mina86*mina86.com]---[mina86*jabber.org]----ooO--(_)--Ooo--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/