HID: bpf: Fix hid_bpf_get_data() range check
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
HID: bpf: Fix hid_bpf_get_data() range check
hid_bpf_get_data() returns a pointer into the HID-BPF context data when the caller-provided offset and size fit inside ctx->allocated_size.
The current check adds rdwr_buf_size and offset before comparing the result against ctx->allocated_size. Since both values are unsigned, a very large size can wrap the sum below ctx->allocated_size and make the helper return a pointer even though the requested range is not contained in the backing buffer.
Use check_add_overflow() to reject wrapped range ends before comparing the requested range end against ctx->allocated_size.
From the CVE record · Linux
The Linux kernel’s hid_bpf_get_data() helper can return a pointer for a requested range outside its backing buffer when an unsigned size calculation wraps. This requires a caller to supply an offset and size that trigger the wrap; the input does not establish whether exploitation requires local access, authentication, or user interaction.
Engineers running Linux kernels with HID-BPF should check their deployments; affected versions were not provided.