• Daniel Mack's avatar
    usb: gadget: f_uac2: handle partial dma area wrap · ec9e4313
    Daniel Mack authored
    With packet sizes other than 512, payloads in the packets may wrap
    around the ALSA dma buffer partially, which leads to memory corruption
    and audible clicks and pops in the audio stream at the moment, because
    there is no boundary check before the memcpy().
    
    In preparation to an implementation for smaller and dynamically sized
    packets, we have to address such cases, and copy the payload in two
    steps conditionally.
    
    The 'src' and 'dst' approach doesn't work here anymore, as different
    behavior is necessary in playback and capture cases. Thus, this patch
    open-codes the routine now.
    Signed-off-by: default avatarDaniel Mack <zonque@gmail.com>
    Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
    ec9e4313
f_uac2.c 38.3 KB