[PATCH] USB gadget: drain rndis response queue on disconnect
authorDavid Brownell <david-b@pacbell.net>
Wed, 25 May 2005 00:51:52 +0000 (17:51 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 27 Jun 2005 21:44:00 +0000 (14:44 -0700)
Drain the rndis response queue on disconnect.  This fixes a problem
in which an rndis response left in the queue from a previous session
could cause a subsequent session to fail.

Signed-off-by: Andy Lowe <alowe@mvista.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/gadget/rndis.c

index c9a0af29ecb683bad3ec72f1c598041b538ce581..06b6eba925b59e5542378eca866387fe4ba9c15e 100644 (file)
@@ -1025,11 +1025,17 @@ int rndis_signal_disconnect (int configNr)
 
 void rndis_uninit (int configNr)
 {
+       u8 *buf;
+       u32 length;
+
        if (configNr >= RNDIS_MAX_CONFIGS)
                return;
        rndis_per_dev_params [configNr].used = 0;
        rndis_per_dev_params [configNr].state = RNDIS_UNINITIALIZED;
-       return;
+
+       /* drain the response queue */
+       while ((buf = rndis_get_next_response(configNr, &length)))
+               rndis_free_response(configNr, buf);
 }
 
 void rndis_set_host_mac (int configNr, const u8 *addr)