media: bpf: ensure bpf program is freed on detach
authorSean Young <sean@mess.org>
Wed, 4 Jul 2018 14:57:58 +0000 (10:57 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Fri, 13 Jul 2018 15:07:29 +0000 (11:07 -0400)
Currently we are leaking bpf programs when they are detached from the
lirc device; the refcount never reaches zero.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/rc/bpf-lirc.c

index 40826bba06b6d52c06bef7eb64bea6a719496dd0..55400317ec539b3388337b1c49e63f0930b916dd 100644 (file)
@@ -174,6 +174,7 @@ static int lirc_bpf_detach(struct rc_dev *rcdev, struct bpf_prog *prog)
 
        rcu_assign_pointer(raw->progs, new_array);
        bpf_prog_array_free(old_array);
+       bpf_prog_put(prog);
 unlock:
        mutex_unlock(&ir_raw_handler_lock);
        return ret;