linux/Documentation/hid
Benjamin Tissoires 9acbb7ba45 HID: bpf: allow hid_device_event hooks to inject input reports on self
This is the same logic than hid_hw_raw_request or hid_hw_output_report:
we can allow hid_bpf_try_input_report to be called from a hook on
hid_input_report if we ensure that the call can not be made twice in a
row.

There is one extra subtlety in which there is a lock in hid_input_report.
But given that we can detect if we are already in the hook, we can notify
hid_input_report to not take the lock. This is done by checking if
ctx_kern data is valid or null, and if it is equal to the dedicated
incoming data buffer.

In order to have more control on whether the lock needs to be taken or not
we introduce a new kfunc for it: hid_bpf_try_input_report()

Link: https://patch.msgid.link/20240626-hid_hw_req_bpf-v2-11-cfd60fb6c79f@kernel.org
Acked-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
2024-06-27 11:00:48 +02:00
..
amd-sfh-hid.rst Documentation: HID: amd-sfh-hid editing & corrections 2021-01-04 11:50:38 +01:00
hid-alps.rst Documentation: hid: correct spelling 2023-02-06 15:00:22 +01:00
hid-bpf.rst HID: bpf: allow hid_device_event hooks to inject input reports on self 2024-06-27 11:00:48 +02:00
hid-sensor.rst Documentation: HID: hid-sensor editing & corrections 2021-01-04 11:50:38 +01:00
hid-transport.rst Documentation: HID: hid-transport editing & corrections 2021-01-04 11:50:39 +01:00
hiddev.rst Documentation: hid: correct spelling 2023-02-06 15:00:22 +01:00
hidintro.rst HID: Add introduction about HID for non-kernel programmers 2023-08-07 13:24:36 +02:00
hidraw.rst Documentation: hid: correct spelling 2023-02-06 15:00:22 +01:00
hidreport-parsing.rst HID: Add introduction about HID for non-kernel programmers 2023-08-07 13:24:36 +02:00
index.rst HID: Add introduction about HID for non-kernel programmers 2023-08-07 13:24:36 +02:00
intel-ish-hid.rst Documentation: hid: intel-ish-hid: add section for firmware loading 2024-05-06 23:33:54 +02:00
uhid.rst Documentation: HID: uhid editing & corrections 2021-01-04 11:50:39 +01:00