Skip to content

Commit 576e619

Browse files
bentissJiri Kosina
authored andcommitted
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: 658ee5a ("HID: bpf: allocate data memory for device_event BPF program") Signed-off-by: Benjamin Tissoires <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent dfae6be commit 576e619

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/linux/hid_bpf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ void hid_bpf_device_init(struct hid_device *hid);
148148
u8 *call_hid_bpf_rdesc_fixup(struct hid_device *hdev, u8 *rdesc, unsigned int *size);
149149
#else /* CONFIG_HID_BPF */
150150
static inline u8 *dispatch_hid_bpf_device_event(struct hid_device *hid, enum hid_report_type type,
151-
u8 *data, u32 *size, int interrupt) { return NULL; }
151+
u8 *data, u32 *size, int interrupt) { return data; }
152152
static inline int hid_bpf_connect_device(struct hid_device *hdev) { return 0; }
153153
static inline void hid_bpf_disconnect_device(struct hid_device *hdev) {}
154154
static inline void hid_bpf_destroy_device(struct hid_device *hid) {}

0 commit comments

Comments
 (0)