[PATCH v4 0/3] usb: gadget: f_hid: GET_REPORT fixes
From: Shunbo Shi
Date: Tue Nov 17 2026 - 07:51:46 EST
Cover-letter:
Hi Greg, Neill,
v4 of this series. Changes from v3, per Neill's review:
- patch 1 (sleep-in-atomic-context fix) is dropped: it
duplicates Yu Zhang's previously reviewed patch [1].
- patch 3: Just copy req->length bytes to keep the existing
UAPI behavior suggested by Neill. Thanks!
Remaining patches (unchanged from v3 except for the race fix):
1. memory leak: report_list entries allocated by the ioctl
are never freed in hidg_release().
2. data race: the GET_REPORT response is served from a
dedicated buffer instead of borrowing a report_list
entry that userspace may update concurrently.
3. memory leak: get_req is leaked when usb_gstrings_attach()
fails in hidg_bind().
[1] https://lore.kernel.org/all/20261020051446.92179-1-yuz08559@xxxxxxxxx/
Shunbo Shi (3):
usb: gadget: f_hid: fix report_list entries leak
usb: gadget: f_hid: fix race between userspace report update and
GET_REPORT response
usb: gadget: f_hid: fix get_req leak when usb_gstrings_attach() fails
drivers/usb/gadget/function/f_hid.c | 34 +++++++++++++++++-----
1 file changed, 35 insertions(+), 6 deletions(-)
--
2.53.0