usb: gadget: f_uac2: validate input parameters
authorRuslan Bilovol <ruslan.bilovol@gmail.com>
Mon, 1 Mar 2021 11:49:33 +0000 (13:49 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 May 2021 12:47:17 +0000 (14:47 +0200)
commitf63390de9b4371b9eae23eb04332a15687925ed1
tree7ac804f65a5d12593df95d5e7c90685824b5a94f
parentdf7452f03b7f27a2805e2a69129a18a5b104108e
usb: gadget: f_uac2: validate input parameters

[ Upstream commit 3713d5ceb04d5ab6a5e2b86dfca49170053f3a5e ]

Currently user can configure UAC2 function with
parameters that violate UAC2 spec or are not supported
by UAC2 gadget implementation.

This can lead to incorrect behavior if such gadget
is connected to the host - like enumeration failure
or other issues depending on host's UAC2 driver
implementation, bringing user to a long hours
of debugging the issue.

Instead of silently accept these parameters, throw
an error if they are not valid.

Signed-off-by: Ruslan Bilovol <ruslan.bilovol@gmail.com>
Link: https://lore.kernel.org/r/1614599375-8803-4-git-send-email-ruslan.bilovol@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/gadget/function/f_uac2.c