usb: gadget: printer: fix infinite loop in printer_read()
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ b185f01a9ab7af586133be2555298e960237359b · < 4cde0b38cc0cb8b7dc17295801015148de37d1d2| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
usb: gadget: printer: fix infinite loop in printer_read()
printer_read() uses the same variable for the requested copy size and the number of bytes actually copied to user space. copy_to_user() returns the number of bytes not copied, so when it fails to copy anything, the computed copied length becomes zero.
In that case len, buf, current_rx_bytes and current_rx_buf are left unchanged. If RX data is available and the user buffer remains unwritable, the read loop can repeat indefinitely.
Track the copied length separately and return -EFAULT, or the number of bytes already copied, if an iteration makes no progress.
From the CVE record · Linux
The Linux kernel USB gadget printer read function can enter an infinite loop when RX data is available and a user-space buffer remains unwritable. A local caller can trigger this by reading with an unwritable buffer; the input does not describe any authentication requirement.
Engineers running the Linux kernel with the USB gadget printer component should check their kernel version; affected versions are not specified.