This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 780407d5852f3c70ba093d322f0047423b84f9f4 Author: yushuailong <[email protected]> AuthorDate: Thu Nov 5 00:29:18 2026 +0800 usbdev/composite: Check configuration for interface requests. Route standard GET_INTERFACE and SET_INTERFACE requests through the existing request cases. The device-recipient-only dispatch condition made those cases unreachable for valid interface requests, so they fell through to unconditional class forwarding. Require an active configuration for both requests and correct the inverted GET_INTERFACE condition. Preserve other interface descriptor, class and vendor requests for their constituent drivers. Validation: 25 extracted production-function host cases passed with ASan/UBSan. Unmodified upstream and the comparison-only fix each failed six cases. The nucleo-h743zi:composite CMake build and image size check passed. Hardware control-transfer testing was not performed. Assisted-by: Codex:GPT-6 Signed-off-by: yushuailong <[email protected]> --- drivers/usbdev/composite.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/usbdev/composite.c b/drivers/usbdev/composite.c index d11584380bd..e36d172deb8 100644 --- a/drivers/usbdev/composite.c +++ b/drivers/usbdev/composite.c @@ -616,7 +616,10 @@ static int composite_setup(FAR struct usbdevclass_driver_s *driver, recipient = ctrl->type & USB_REQ_RECIPIENT_MASK; if ((ctrl->type & USB_REQ_TYPE_MASK) == USB_REQ_TYPE_STANDARD && - recipient == USB_REQ_RECIPIENT_DEVICE) + (recipient == USB_REQ_RECIPIENT_DEVICE || + (recipient == USB_REQ_RECIPIENT_INTERFACE && + (ctrl->req == USB_REQ_GETINTERFACE || + ctrl->req == USB_REQ_SETINTERFACE)))) { /********************************************************************** * Standard Requests @@ -756,7 +759,7 @@ static int composite_setup(FAR struct usbdevclass_driver_s *driver, { if (ctrl->type == (USB_DIR_IN | USB_REQ_RECIPIENT_INTERFACE) && - priv->config == COMPOSITE_CONFIGIDNONE) + priv->config != COMPOSITE_CONFIGIDNONE) { ret = composite_classsetup(priv, dev, ctrl, dataout, outlen);
