[PATCH v2 0/2] HID: bpf: fix device destruction races

From: Yifan Zhang

Date: Mon Nov 02 2026 - 21:45:32 EST


These patches fix two HID-BPF races with device destruction. The first
keeps report metadata and transport-private state alive across hardware
operations. The second prevents struct_ops registration from publishing
an entry after destruction has started.

Changes in v2:
- use a short lifetime admission lock and SRCU instead of holding
prog_list_lock across low-level driver calls
- acquire lifetime protection before looking up the HID report
- clear ops->hdev on registration errors before dropping the device ref

Yifan Zhang (2):
HID: bpf: synchronize hardware operations with device destruction
HID: bpf: reject struct_ops registration during device destruction

drivers/hid/bpf/hid_bpf_dispatch.c | 73 ++++++++++++++++++++--------
drivers/hid/bpf/hid_bpf_struct_ops.c | 12 ++++-
include/linux/hid_bpf.h | 1 +
3 files changed, 65 insertions(+), 21 deletions(-)

--
2.39.5 (Apple Git-154)