mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 01:32:21 +02:00
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.
Fixes:
|
||
|---|---|---|
| .. | ||
| progs | ||
| hid_bpf_dispatch.c | ||
| hid_bpf_dispatch.h | ||
| hid_bpf_struct_ops.c | ||
| Kconfig | ||
| Makefile | ||