linux/drivers/usb/gadget
Alan Stern 04eee25b1d USB: gadget: storage: remove alignment assumption
This patch (as1481) fixes a problem affecting g_file_storage and
g_mass_storage when running at SuperSpeed.  The two drivers currently
assume that the bulk-out maxpacket size can evenly divide the SCSI
block size, which is 512 bytes.  But SuperSpeed bulk endpoints have a
maxpacket size of 1024, so the assumption is no longer true.

This patch removes that assumption from the drivers, by getting rid of
a small optimization (they try to align VFS reads and writes on page
cache boundaries).  If a command's starting logical block address is
512 bytes below the end of a page, it's not okay to issue a USB
command for just those 512 bytes when the maxpacket size is 1024 -- it
would result in either babble (for an OUT transfer) or a short packet
(for an IN transfer).

Also, for backward compatibility, the test for writes extending beyond
the end of the backing storage has to be changed.  If the host tries
to do this, we should accept the data that fits in the backing storage
and ignore the rest.  Because the storage's end may not align with a
USB packet boundary, this means we may have to accept a USB OUT
transfer that extends beyond the end of the storage and then write out
only the part of the data that fits.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2011-09-09 13:06:03 +03:00
..
amd5536udc.c USB: use usb_endpoint_maxp() instead of le16_to_cpu() 2011-08-23 09:47:40 -07:00
amd5536udc.h
at91_udc.c USB: use usb_endpoint_maxp() instead of le16_to_cpu() 2011-08-23 09:47:40 -07:00
at91_udc.h
atmel_usba_udc.c USB: use usb_endpoint_maxp() instead of le16_to_cpu() 2011-08-23 09:47:40 -07:00
atmel_usba_udc.h
audio.c usb: gadget: add max_speed to usb_composite_driver 2011-07-01 14:27:05 -07:00
cdc2.c usb: gadget: add max_speed to usb_composite_driver 2011-07-01 14:27:05 -07:00
ci13xxx_msm.c usb: gadget: add platform module alias where it is missing 2011-07-01 14:27:07 -07:00
ci13xxx_pci.c
ci13xxx_udc.c USB: use usb_endpoint_maxp() instead of le16_to_cpu() 2011-08-23 09:47:40 -07:00
ci13xxx_udc.h
composite.c USB: use usb_endpoint_maxp() instead of le16_to_cpu() 2011-08-23 09:47:40 -07:00
config.c usb: gadget: use config_ep_by_speed() instead of ep_choose() 2011-06-28 11:14:37 -07:00
dbgp.c usb: gadget: defer setting maxpacket till ->setup() 2011-07-01 14:31:12 -07:00
dummy_hcd.c USB: use usb_endpoint_maxp() instead of le16_to_cpu() 2011-08-23 09:47:40 -07:00
epautoconf.c USB: use usb_endpoint_maxp() instead of le16_to_cpu() 2011-08-23 09:47:40 -07:00
ether.c usb: gadget: add SS descriptors to Ethernet gadget 2011-07-08 13:55:30 +03:00
f_acm.c usb: gadget: use config_ep_by_speed() instead of ep_choose() 2011-06-28 11:14:37 -07:00
f_audio.c atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
f_ecm.c usb: gadget: add SS descriptors to Ethernet gadget 2011-07-08 13:55:30 +03:00
f_eem.c usb: gadget: add SS descriptors to Ethernet gadget 2011-07-08 13:55:30 +03:00
f_fs.c usb: gadget: add usb_endpoint_descriptor to struct usb_ep 2011-06-28 11:14:36 -07:00
f_hid.c usb: gadget: hid: don't STALL when processing a HID Descriptor request 2011-08-01 22:06:47 +03:00
f_loopback.c usb: gadget: zero: add superspeed support 2011-07-08 13:57:54 +03:00
f_mass_storage.c USB: gadget: storage: remove alignment assumption 2011-09-09 13:06:03 +03:00
f_ncm.c usb: gadget: use config_ep_by_speed() instead of ep_choose() 2011-06-28 11:14:37 -07:00
f_obex.c usb: gadget: use config_ep_by_speed() instead of ep_choose() 2011-06-28 11:14:37 -07:00
f_phonet.c Merge branch 'usb-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6 2011-07-25 23:08:32 -07:00
f_rndis.c atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
f_serial.c usb: gadget: use config_ep_by_speed() instead of ep_choose() 2011-06-28 11:14:37 -07:00
f_sourcesink.c usb: gadget: zero: add superspeed support 2011-07-08 13:57:54 +03:00
f_subset.c usb: gadget: add SS descriptors to Ethernet gadget 2011-07-08 13:55:30 +03:00
f_uvc.c USB: Gadget: Webcam: Return correct result of bind 2011-07-01 14:45:42 -07:00
f_uvc.h
file_storage.c USB: gadget: storage: remove alignment assumption 2011-09-09 13:06:03 +03:00
fsl_mxc_udc.c
fsl_qe_udc.c USB: use usb_endpoint_maxp() instead of le16_to_cpu() 2011-08-23 09:47:40 -07:00
fsl_qe_udc.h
fsl_udc_core.c USB: use usb_endpoint_maxp() instead of le16_to_cpu() 2011-08-23 09:47:40 -07:00
fsl_usb2_udc.h
fusb300_udc.c USB: use usb_endpoint_maxp() instead of le16_to_cpu() 2011-08-23 09:47:40 -07:00
fusb300_udc.h
g_ffs.c usb: gadget: add max_speed to usb_composite_driver 2011-07-01 14:27:05 -07:00
g_zero.h
gadget_chips.h usb: gadget: introduce gadget_is_dwc3() 2011-08-22 16:00:46 -07:00
gmidi.c usb: gadget: defer setting maxpacket till ->setup() 2011-07-01 14:31:12 -07:00
goku_udc.c usb: gadget: convert all users to the new udc infrastructure 2011-06-28 11:13:35 -07:00
goku_udc.h
hid.c usb: gadget: add max_speed to usb_composite_driver 2011-07-01 14:27:05 -07:00
imx_udc.c USB: use usb_endpoint_maxp() instead of le16_to_cpu() 2011-08-23 09:47:40 -07:00
imx_udc.h
inode.c usb: gadget: defer setting maxpacket till ->setup() 2011-07-01 14:31:12 -07:00
Kconfig USB gadget i.MX1: remove dependency on ARCH_MXC 2011-08-24 15:06:54 -07:00
langwell_udc.c USB: use usb_endpoint_maxp() instead of le16_to_cpu() 2011-08-23 09:47:40 -07:00
langwell_udc.h
m66592-udc.c USB: use usb_endpoint_maxp() instead of le16_to_cpu() 2011-08-23 09:47:40 -07:00
m66592-udc.h usb: gadget: m66592-udc: add function for external controller 2011-07-09 01:08:39 +03:00
Makefile usb: gadget: convert all users to the new udc infrastructure 2011-06-28 11:13:35 -07:00
mass_storage.c usb: gadget: add max_speed to usb_composite_driver 2011-07-01 14:27:05 -07:00
multi.c usb: gadget: add max_speed to usb_composite_driver 2011-07-01 14:27:05 -07:00
mv_udc_core.c USB: use usb_endpoint_maxp() instead of le16_to_cpu() 2011-08-23 09:47:40 -07:00
mv_udc_phy.c
mv_udc.h
ncm.c usb: gadget: add max_speed to usb_composite_driver 2011-07-01 14:27:05 -07:00
ndis.h
net2272.c USB: use usb_endpoint_maxp() instead of le16_to_cpu() 2011-08-23 09:47:40 -07:00
net2272.h
net2280.c USB: use usb_endpoint_maxp() instead of le16_to_cpu() 2011-08-23 09:47:40 -07:00
net2280.h
nokia.c usb: gadget: add max_speed to usb_composite_driver 2011-07-01 14:27:05 -07:00
omap_udc.c USB: use usb_endpoint_maxp() instead of le16_to_cpu() 2011-08-23 09:47:40 -07:00
omap_udc.h
pch_udc.c USB: use usb_endpoint_maxp() instead of le16_to_cpu() 2011-08-23 09:47:40 -07:00
printer.c Merge branch 'usb-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6 2011-07-25 23:08:32 -07:00
pxa25x_udc.c USB: use usb_endpoint_maxp() instead of le16_to_cpu() 2011-08-23 09:47:40 -07:00
pxa25x_udc.h
pxa27x_udc.c USB: use usb_endpoint_maxp() instead of le16_to_cpu() 2011-08-23 09:47:40 -07:00
pxa27x_udc.h treewide: transciever/transceiver spelling fixes 2011-06-24 11:20:14 +02:00
r8a66597-udc.c USB: use usb_endpoint_maxp() instead of le16_to_cpu() 2011-08-23 09:47:40 -07:00
r8a66597-udc.h usb: update email address in r8a66597-udc and m66592-udc 2011-07-08 12:47:27 +03:00
rndis.c
rndis.h
s3c2410_udc.c USB: use usb_endpoint_maxp() instead of le16_to_cpu() 2011-08-23 09:47:40 -07:00
s3c2410_udc.h
s3c-hsotg.c USB: use usb_endpoint_maxp() instead of le16_to_cpu() 2011-08-23 09:47:40 -07:00
s3c-hsudc.c USB: use usb_endpoint_maxp() instead of le16_to_cpu() 2011-08-23 09:47:40 -07:00
serial.c usb: gadget: add max_speed to usb_composite_driver 2011-07-01 14:27:05 -07:00
storage_common.c usb: gadget: storage: adapt logic block size to bound block devices 2011-09-09 13:06:02 +03:00
u_audio.c
u_audio.h
u_ether.c usb: gadget: add SS descriptors to Ethernet gadget 2011-07-08 13:55:30 +03:00
u_ether.h usb: gadget: add usb_endpoint_descriptor to struct usb_ep 2011-06-28 11:14:36 -07:00
u_phonet.h
u_serial.c usb: gadget: add usb_endpoint_descriptor to struct usb_ep 2011-06-28 11:14:36 -07:00
u_serial.h usb: gadget: add usb_endpoint_descriptor to struct usb_ep 2011-06-28 11:14:36 -07:00
udc-core.c usb: gadget: udc-core: wire up sysfs files 2011-07-01 14:31:14 -07:00
usbstring.c
uvc_queue.c atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
uvc_queue.h
uvc_v4l2.c [media] v4l2-event/ctrls/fh: allocate events per fh and per type instead of just per-fh 2011-07-27 17:53:31 -03:00
uvc_video.c
uvc.h
webcam.c usb: gadget: add max_speed to usb_composite_driver 2011-07-01 14:27:05 -07:00
zero.c usb: gadget: zero: add superspeed support 2011-07-08 13:57:54 +03:00