lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BYAPR07MB5381F9748155F73732090E87DD489@BYAPR07MB5381.namprd07.prod.outlook.com>
Date:   Tue, 20 Apr 2021 03:56:25 +0000
From:   Pawel Laszczak <pawell@...ence.com>
To:     Peter Chen <peter.chen@...nel.org>
CC:     "balbi@...nel.org" <balbi@...nel.org>,
        "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
        "ruslan.bilovol@...il.com" <ruslan.bilovol@...il.com>,
        "jbrunet@...libre.com" <jbrunet@...libre.com>,
        "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Rahul Kumar <kurahul@...ence.com>
Subject: RE: [PATCH 1/2] usb: gadget: f_uac2: Stop endpoint before enabling
 it.

>On 21-04-19 09:50:53, Pawel Laszczak wrote:
>> From: Pawel Laszczak <pawell@...ence.com>
>>
>> Patch adds disabling endpoint before enabling it during changing
>> alternate setting. Lack of this functionality causes that in some
>> cases uac2 queue the same request multiple time.
>> Such situation can occur when host send set interface with
>> alternate setting 1 twice.
>>
>> Signed-off-by: Pawel Laszczak <pawell@...ence.com>
>> ---
>>  drivers/usb/gadget/function/f_uac2.c | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c
>> index 9cc5c512a5cd..7d20a9d8a1b4 100644
>> --- a/drivers/usb/gadget/function/f_uac2.c
>> +++ b/drivers/usb/gadget/function/f_uac2.c
>> @@ -890,17 +890,17 @@ afunc_set_alt(struct usb_function *fn, unsigned intf, unsigned alt)
>>  	if (intf == uac2->as_out_intf) {
>>  		uac2->as_out_alt = alt;
>>
>> +		u_audio_stop_capture(&uac2->g_audio);
>> +
>>  		if (alt)
>>  			ret = u_audio_start_capture(&uac2->g_audio);
>> -		else
>> -			u_audio_stop_capture(&uac2->g_audio);
>>  	} else if (intf == uac2->as_in_intf) {
>>  		uac2->as_in_alt = alt;
>>
>> +		u_audio_stop_playback(&uac2->g_audio);
>> +
>>  		if (alt)
>>  			ret = u_audio_start_playback(&uac2->g_audio);
>> -		else
>> -			u_audio_stop_playback(&uac2->g_audio);
>>  	} else {
>>  		dev_err(dev, "%s:%d Error!\n", __func__, __LINE__);
>>  		return -EINVAL;
>
>To avoid this, you may use prm->ep_enabled to judge if the endpoint has
>already enabled.

Such condition is as first instruction inside u_audio_stop_playback->free_ep  function,
so we don't need duplicate it here.

>
>--
>
>Thanks,
>Peter Chen

--

Regards,
Pawe Laszczak

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ