usb: gadget: uvc: clamp SEND_RESPONSE length to the response buffer
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ a5eaaa1f33e771fa1651a4a7652b8a5f9fa7f6c1 · < 1f03658f3e9b2f8fd1d1003ba389a0390b49a350| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
usb: gadget: uvc: clamp SEND_RESPONSE length to the response buffer
uvc_send_response() builds the UVC control response from a user-supplied struct uvc_request_data:
req->length = min_t(unsigned int, uvc->event_length, data->length); ... memcpy(req->buf, data->data, req->length);
req->length is clamped to uvc->event_length, which is taken from the host control request wLength (up to UVC_MAX_REQUEST_SIZE, 64), and to data->length, which comes from the UVCIOC_SEND_RESPONSE ioctl and is only checked for being negative. The source buffer data->data is only 60 bytes, so a response with uvc->event_length and data->length both greater than 60 makes memcpy() read past the end of data->data.
Clamp req->length to sizeof(data->data) as well.
From the CVE record · Linux
The Linux kernel USB gadget UVC response handler can read past a 60-byte buffer when a host control request and a UVCIOC_SEND_RESPONSE ioctl response both specify lengths greater than 60 bytes. The issue requires both the host request and a user-supplied ioctl response; the input does not establish whether an attacker can trigger it without local access or authorization.
Engineers running Linux kernels with USB gadget UVC support should check whether their kernel includes the fix; affected versions were not provided.