rockbox/firmware
Aidan MacDonald 24294bda15 usb: ensure RX buffers are a multiple of the packet size
When performing an OUT transfer which is not a multiple of the
max packet size, the last packet of the OUT transfer should be
a short packet. However, there's no guarantee the host sends
the expected amount of data in the final packet.

The DWC2 USB controller handles this case by accepting any size
packet and copying it out to memory. So if the packet is bigger
than expected, it'll overrun the caller's buffer and Bad Things
will happen.

The USB 2.0 spec seems to endorse this behavior. Section 8.5.1
says "an ACK handshake indicates the endpoint has space for a
wMaxPacketSize data payload." So it is possible that other USB
controllers share the DWC2's behavior.

The simplest solution is to force all USB RX buffers to be big
enough to hold the transfer size, rounded up to a multiple of
the max packet size. For example, a transfer of 700 bytes would
require a 1024-byte buffer if the MPS = 512 bytes.

Change-Id: Ibb84d2b2d53aec8800a3a7c2449f7a17480acbcf
2021-10-16 21:14:42 +01:00
..
asm Rename symbols of FiiO M3K Linux-based port 2021-02-27 23:53:28 +00:00
common Dir cache: Fix resume of relative path playlists. 2021-09-19 21:05:58 -04:00
drivers usb: introduce new control request API 2021-10-16 15:58:43 -04:00
export usb: implement new API with legacy emulation layer 2021-10-16 21:14:42 +01:00
include inflate: fix public function pointers 2021-08-09 16:25:43 +00:00
kernel Add ability to dump cpu boost log to disk, include thread names 2021-09-30 21:13:22 -04:00
libc libc: atoi() is supposed to return 0 if handed a NULL pointer 2021-07-30 01:41:13 +00:00
target usb: introduce new control request API 2021-10-16 15:58:43 -04:00
usbstack usb: ensure RX buffers are a multiple of the packet size 2021-10-16 21:14:42 +01:00
COPYING
README
SOURCES Remove the (very) incomplete port for the Tatung TPJ-1102 2021-08-14 16:29:39 -04:00
arabjoin.c
arabjoin.h
ata_idle_notify.c Fix reds. 2014-03-14 23:43:45 +01:00
backlight-sw-fading.c For backlights that have a wide control, support skipping steps. 2020-10-02 02:45:43 +00:00
backlight.c Fix reversal of "always/never" in "LCD setting > Sleep (After Backlight Off)" 2019-06-27 14:19:05 +02:00
bidi.c bidi.c: Check buffer sizes. 2014-01-09 23:30:32 +01:00
buflib.c Buflib_init Bugfix Minsize 2020-07-15 13:29:21 +00:00
core_alloc.c Sansa E200v1 Bootloader attempt at enabling USB in boot loader 2021-10-04 10:56:33 -04:00
debug.c [1/4] Remove SH support and all archos targets 2020-07-24 21:20:13 +00:00
eeprom_settings.c
enc_base.c FS#12378 : Remove various unused code, and comment out some unused code and data for reference or future use. 2011-12-14 21:45:25 +00:00
events.c Make thirty functions static to reduce binary size 2015-01-05 18:44:36 +01:00
firmware.make fonts: Use '08-Rockfont' as FONT_SYSFIXED on targets with 128x64 screens 2020-08-31 13:32:24 -04:00
font.c misc: Only include rbpaths.h and string-extra.h in places that need it 2021-04-10 12:08:12 -04:00
font_cache.c fonts: Do not unload completely on USB. 2014-01-15 23:37:39 +01:00
general.c [3/4] Completely remove HWCODEC support 2020-07-24 21:20:13 +00:00
hangul.c
load_code.c Fix various reds. Some includes needed fixup. 2014-03-03 19:10:48 +01:00
logf.c logf: Fix an incorrect fix in 835d0c737a 2021-08-15 09:03:16 -04:00
lru.c
panic.c [4/4] Remove HAVE_LCD_BITMAP, as it's now the only choice. 2020-07-24 21:20:13 +00:00
pcm.c pcm: Further cleanup of unused bits of the PCM ACPI: 2020-11-12 15:59:09 +00:00
pcm_mixer.c pcm_mixer: Fix an idle frame calculation bug introduced in 2e708c48c5 2020-10-24 02:00:50 +00:00
pcm_sampr.c pcm: Missed a file for the 192/176K playback. 2020-09-30 22:03:34 -04:00
pcm_sw_volume.c move PCM_NATIVE_BITDEPTH definiton into global config code 2021-08-07 11:18:19 -04:00
powermgmt.c powermgmt: Clean up some convoluted #ifdefs 2021-08-04 09:39:37 -04:00
profile.c
rolo.c mi4: replace chksum_crc32 with crc_32r 2021-06-21 09:36:54 +00:00
rom.lds h300: add support for ROM image generation 2020-10-26 01:37:42 +00:00
screendump.c Fix path buffer overflow in screendump 2021-08-06 15:46:53 +00:00
scroll_engine.c ClipPlus BOOTLOADER DONT FIT! 2020-10-23 20:38:59 -04:00
sdmmc.c
sound.c Revert "sound: add sound_numdecimals() to round out the sound setting query API" 2021-04-09 10:52:02 +00:00
storage.c FS#13154: Don't discard return code in storage_init() 2020-08-24 14:37:23 -04:00
system.c Add ability to dump cpu boost log to disk, include thread names 2021-09-30 21:13:22 -04:00
timer.c Fix timer Agptek Rocker (other hosted players) 2019-10-17 21:19:00 +02:00
tuner.c [1/4] Remove SH support and all archos targets 2020-07-24 21:20:13 +00:00
usb.c Nuke all TCC77x targets: iAudio 7, Sansa C100, M200(v1-3), Logik DAX 2021-04-26 07:41:51 -04:00

README

See docs/README