Commit 6a083d40 authored by Prashanth K's avatar Prashanth K Committed by Wen Zhiwei
Browse files

usb: gadget: f_uac2: Fix incorrect setting of bNumEndpoints

stable inclusion
from stable-v6.6.72
commit c1e7ced99da9fabe5fd7eb31a921e51bc9bcafcf
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IBQN9L

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=c1e7ced99da9fabe5fd7eb31a921e51bc9bcafcf



--------------------------------

commit 057bd54dfcf68b1f67e6dfc32a47a72e12198495 upstream.

Currently afunc_bind sets std_ac_if_desc.bNumEndpoints to 1 if
controls (mute/volume) are enabled. During next afunc_bind call,
bNumEndpoints would be unchanged and incorrectly set to 1 even
if the controls aren't enabled.

Fix this by resetting the value of bNumEndpoints to 0 on every
afunc_bind call.

Fixes: eaf6cbe0 ("usb: gadget: f_uac2: add volume and mute support")
Cc: stable <stable@kernel.org>
Signed-off-by: default avatarPrashanth K <quic_prashk@quicinc.com>
Link: https://lore.kernel.org/r/20241211115915.159864-1-quic_prashk@quicinc.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarWen Zhiwei <wenzhiwei@kylinos.cn>
parent 4e44ecb2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1176,6 +1176,7 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn)
		uac2->as_in_alt = 0;
	}

	std_ac_if_desc.bNumEndpoints = 0;
	if (FUOUT_EN(uac2_opts) || FUIN_EN(uac2_opts)) {
		uac2->int_ep = usb_ep_autoconfig(gadget, &fs_ep_int_desc);
		if (!uac2->int_ep) {