usb: gadget: configfs: fix out-of-bounds read of qw_sign
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 76180d716f91f035d9c8639497cf5459b44e1a51 · < afbf39c0f2297c6abef6d670a82a2079b0836191| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
usb: gadget: configfs: fix out-of-bounds read of qw_sign
os_desc_qw_sign_show() passes OS_STRING_QW_SIGN_LEN as the input length to utf16s_to_utf8s(), but that argument counts UTF-16 code units while OS_STRING_QW_SIGN_LEN (14) is the byte size of qw_sign[]. The array holds only OS_STRING_QW_SIGN_LEN / 2 (7) code units, so the conversion reads up to 7 units (14 bytes) past the end of qw_sign[] into the following members of struct gadget_info when the stored signature fills the array without a NUL terminator, exposing those bytes through the configfs attribute.
The store path halves the count for its input bound but passes the full byte count as the utf8s_to_utf16s() output limit; use the destination code-unit count in both directions.
From the CVE record · Linux
The Linux kernel's USB gadget configfs handler can read past the end of the qw_sign array when the stored signature has no NUL terminator. Someone able to read the affected configfs attribute could see bytes from adjacent kernel structure members.
Engineers running Linux kernels with USB gadget configfs should check their systems; affected versions were not specified.