Commit 576e619b authored by Benjamin Tissoires's avatar Benjamin Tissoires Committed by Jiri Kosina

HID: bpf: return non NULL data pointer when CONFIG_HID_BPF is not set

dispatch_hid_bpf_device_event() is supposed to return either an error,
or a valid pointer to memory containing the data.

Returning NULL simply makes a segfault when CONFIG_HID_BPF is not set
for any processed event.

Fixes: 658ee5a6 ("HID: bpf: allocate data memory for device_event BPF program")
Signed-off-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent dfae6bec
...@@ -148,7 +148,7 @@ void hid_bpf_device_init(struct hid_device *hid); ...@@ -148,7 +148,7 @@ void hid_bpf_device_init(struct hid_device *hid);
u8 *call_hid_bpf_rdesc_fixup(struct hid_device *hdev, u8 *rdesc, unsigned int *size); u8 *call_hid_bpf_rdesc_fixup(struct hid_device *hdev, u8 *rdesc, unsigned int *size);
#else /* CONFIG_HID_BPF */ #else /* CONFIG_HID_BPF */
static inline u8 *dispatch_hid_bpf_device_event(struct hid_device *hid, enum hid_report_type type, static inline u8 *dispatch_hid_bpf_device_event(struct hid_device *hid, enum hid_report_type type,
u8 *data, u32 *size, int interrupt) { return NULL; } u8 *data, u32 *size, int interrupt) { return data; }
static inline int hid_bpf_connect_device(struct hid_device *hdev) { return 0; } static inline int hid_bpf_connect_device(struct hid_device *hdev) { return 0; }
static inline void hid_bpf_disconnect_device(struct hid_device *hdev) {} static inline void hid_bpf_disconnect_device(struct hid_device *hdev) {}
static inline void hid_bpf_destroy_device(struct hid_device *hid) {} static inline void hid_bpf_destroy_device(struct hid_device *hid) {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment