[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210112194143.1494-5-yuri.benditovich@daynix.com>
Date: Tue, 12 Jan 2021 21:41:40 +0200
From: Yuri Benditovich <yuri.benditovich@...nix.com>
To: davem@...emloft.net, kuba@...nel.org, mst@...hat.com,
jasowang@...hat.com, ast@...nel.org, daniel@...earbox.net,
andrii@...nel.org, kafai@...com, songliubraving@...com, yhs@...com,
john.fastabend@...il.com, kpsingh@...nel.org,
rdunlap@...radead.org, willemb@...gle.com, gustavoars@...nel.org,
herbert@...dor.apana.org.au, steffen.klassert@...unet.com,
nogikh@...gle.com, pablo@...filter.org, decui@...rosoft.com,
cai@....pw, jakub@...udflare.com, elver@...gle.com,
pabeni@...hat.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
virtualization@...ts.linux-foundation.org, bpf@...r.kernel.org
Cc: yan@...nix.com
Subject: [RFC PATCH 4/7] tun: free bpf_program by bpf_prog_put instead of bpf_prog_destroy
The module never creates the bpf program with bpf_prog_create
so it shouldn't free it with bpf_prog_destroy.
The program is obtained by bpf_prog_get and should be freed
by bpf_prog_put. For BPF_PROG_TYPE_SOCKET_FILTER both
methods do the same but for other program types they don't.
Signed-off-by: Yuri Benditovich <yuri.benditovich@...nix.com>
---
drivers/net/tun.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 455f7afc1f36..18c1baf1a6c1 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -2218,7 +2218,7 @@ static void tun_prog_free(struct rcu_head *rcu)
{
struct tun_prog *prog = container_of(rcu, struct tun_prog, rcu);
- bpf_prog_destroy(prog->prog);
+ bpf_prog_put(prog->prog);
kfree(prog);
}
--
2.17.1
Powered by blists - more mailing lists