From: Jim Sung Date: Fri, 5 Nov 2010 01:47:51 +0000 (-0700) Subject: usb: subtle increased memory usage in u_serial X-Git-Tag: v2.6.37-rc2~23^2~6 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=28609d4083bcd4879e951b0c4ecf4c3a88761261;p=pandora-kernel.git usb: subtle increased memory usage in u_serial OK, the USB gadget serial driver actually has a couple of problems. On gs_open(), it always allocates and queues an additional QUEUE_SIZE (16) worth of requests, so with a loop like this: i=1 ; while echo $i > /dev/ttyGS0 ; do let i++ ; done eventually we run into OOM (Out of Memory). Technically, it is not a leak as everything gets freed up when the USB connection is broken, but not on gs_close(). With a USB device/gadget controller driver that has limited resources (e.g., Marvell has a this MAX_XDS_FOR_TR_CALLS of 64 for transmit and receive), so even after 4 stty -F /dev/ttyGS0 we cannot transmit anymore. We can still receive (not necessarily reliably) as now we have 16 * 4 = 64 descriptors/buffers ready, but the device is otherwise not usable. Signed-off-by: Jim Sung Signed-off-by: Greg Kroah-Hartman --- Reading git-diff-tree failed