HID: bpf: protect HID-BPF prog_list access by a SRCU
authorBenjamin Tissoires <bentiss@kernel.org>
Wed, 26 Jun 2024 13:46:24 +0000 (15:46 +0200)
committerBenjamin Tissoires <bentiss@kernel.org>
Thu, 27 Jun 2024 08:58:22 +0000 (10:58 +0200)
commit6cd735f0e57a6c8510ad92f5b63837a8d0cff3a7
treedcd4c66314d7a4fedf3438f199f34ddc24bcf3db
parent67eccf151d76a9939ad8a50c6db5cb486b01df24
HID: bpf: protect HID-BPF prog_list access by a SRCU

We want to add sleepable callbacks for hid_hw_raw_request() and
hid_hw_output_report(), but we can not use a plain RCU for those.

Prepare for a SRCU so we can extend HID-BPF.

This changes a little bit how hid_bpf_device_init() behaves, as it may
now fail, so there is a tiny hid-core.c change to accommodate for this.

Link: https://patch.msgid.link/20240626-hid_hw_req_bpf-v2-3-cfd60fb6c79f@kernel.org
Acked-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
drivers/hid/bpf/hid_bpf_dispatch.c
drivers/hid/bpf/hid_bpf_struct_ops.c
drivers/hid/hid-core.c
include/linux/hid_bpf.h