Legacy USB audio gadget can overflow the heap; maintainer wants a clearer fix
Independent buffer-size settings let a USB host write past a tiny accumulation buffer, and Greg Kroah-Hartman sent the report back for a rewrite.
A heap overflow in Linux's legacy USB audio gadget can corrupt kernel memory when the function's two buffer sizes are set independently and a USB host sends a packet larger than the accumulation buffer.
Haofeng Li reported the flaw in the older UAC1 gadget function, which is still available through configfs. The size of the buffer used to accumulate playback audio and the size of each USB request buffer are separate attributes. Nothing requires the accumulation buffer to be at least as large as a request. When an incoming packet does not fit in the space left, the completion path queues the current buffer for playback, allocates a fresh one of the configured accumulation size, and then copies the whole packet into it. If that packet is larger than the new allocation, the copy runs past the end of the object.
Li wrote that the write is silent. Compile-time fortification cannot see the destination size through a runtime offset, and generic KASAN does not flag the access because neighboring slab objects remain mapped. On a 7.2.0 or later kernel, with KASAN and SLUB redzones enabled, a 200-byte packet into a 1-byte buffer landed entirely outside the allocation and into the redzone. The resulting freelist corruption hung the machine with a fault during later device enumeration.
Triggering it needs write access to the gadget's configfs attributes before the function is bound, plus control of the USB host. No race is required. Li's fix clamps the copy to the space actually left in the accumulation buffer. Configurations in which a request already fits are unchanged; oversized packets lose their excess bytes instead of corrupting the heap.
Greg Kroah-Hartman, who maintains the USB subsystem, did not take the change as written. Nearly three months after the report, he replied: "What does this paragraph mean? Please rewrite this whole changelog in your own words." The overflow therefore remains an open report until a clearer description lands.