usb: gadget: u_audio: remove cached period bytes value
authorVladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Thu, 21 Jun 2018 15:22:50 +0000 (17:22 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Sep 2018 07:26:26 +0000 (09:26 +0200)
commitc7d18686e87a62167fa04472c4b0ca16e77acdc7
tree5d7b1ac0b0a8b07997e4b7024ae78b95a3248bde
parent42b09bece176fdbf3b8ebc459b5046901ac49be4
usb: gadget: u_audio: remove cached period bytes value

[ Upstream commit 773e53d50e227b0c03d0bb434c1636f6c49c75b2 ]

Substream period size potentially can be changed in runtime, however
this is not accounted in the data copying routine, the change replaces
the cached value with an actual value from substream runtime.

As a side effect the change also removes a potential division by zero
in u_audio_iso_complete() function, if there is a race with
uac_pcm_hw_free(), which sets prm->period_size to 0.

Fixes: 132fcb460839 ("usb: gadget: Add Audio Class 2.0 Driver")
Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/u_audio.c