]> git.baikalelectronics.ru Git - kernel.git/commit
usb: gadget: f_uac2: handle partial dma area wrap
authorDaniel Mack <zonque@gmail.com>
Wed, 27 Aug 2014 17:09:06 +0000 (19:09 +0200)
committerFelipe Balbi <balbi@ti.com>
Tue, 2 Sep 2014 14:17:07 +0000 (09:17 -0500)
commit599768237a3fc9f1118609d052da9f78b54529fe
treefd4d1c21dd175c27ec868cdfefe817d7cb863627
parent8a72474691ac7f1b75736b46853eb325a63efd34
usb: gadget: f_uac2: handle partial dma area wrap

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: Daniel Mack <zonque@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/gadget/function/f_uac2.c