]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
HID: bpf: actually free hdev memory after attaching a HID-BPF program
authorBenjamin Tissoires <bentiss@kernel.org>
Wed, 24 Jan 2024 11:26:58 +0000 (12:26 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Feb 2024 08:51:30 +0000 (09:51 +0100)
commit46b08e8f1baef9d4fb92b4fad2ac6fda458bcbc6
tree8c9f99ee21d681b8525a585919e2a9440cbd1f60
parent1211da213a10bcbab3f232885f799d346ef19fb7
HID: bpf: actually free hdev memory after attaching a HID-BPF program

commit 89be8aa5b0ecb3b729c7bcff64bb2af7921fec63 upstream.

Turns out that I got my reference counts wrong and each successful
bus_find_device() actually calls get_device(), and we need to manually
call put_device().

Ensure each bus_find_device() gets a matching put_device() when releasing
the bpf programs and fix all the error paths.

Cc: <stable@vger.kernel.org>
Fixes: f5c27da4e3c8 ("HID: initial BPF implementation")
Link: https://lore.kernel.org/r/20240124-b4-hid-bpf-fixes-v2-2-052520b1e5e6@kernel.org
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hid/bpf/hid_bpf_dispatch.c
drivers/hid/bpf/hid_bpf_jmp_table.c