]> git.karo-electronics.de Git - karo-tx-linux.git/commit
USB: usbmon: fix bug in mon_buff_area_shrink
authorAlan Stern <stern@rowland.harvard.edu>
Wed, 4 Nov 2009 16:35:53 +0000 (11:35 -0500)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 8 Dec 2009 18:21:26 +0000 (10:21 -0800)
commit5f1e43635144fd054218d3423ab4c86c2ea16755
treeceef61d385bbae7529698a1449f85f5236751434
parent49cb656ba98a71f5dbc0f7c5dd2b1e35d32e673d
USB: usbmon: fix bug in mon_buff_area_shrink

commit fca94748c5136ff390eadc443871b82f1f77dcd6 upstream.

This patch (as1299b) fixes a bug in an error-handling path of usbmon's
binary interface.  The storage area for URB data is divided into
fixed-size blocks.  If an URB's data can't be copied, the area
reserved for it should be decreased to the size of the truncated
information (rounded up to a block boundary).  Rounding up the amount
to be removed and subtracting it from the reserved size is definitely
the wrong thing to do.

Also, when the data for an isochronous URB can't be copied, we can
still copy the isoc packet descriptors.  In fact the current code does
copy the descriptors, but then sets the capture length to 0 so they
remain inaccessible.  The capture length should be reduced to the
length of the descriptors, not set to 0.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/mon/mon_bin.c