lkml.org 
[lkml]   [2021]   [Jan]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[RFC PATCH 4/7] tun: free bpf_program by bpf_prog_put instead of bpf_prog_destroy
    Date
    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@daynix.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
    \
     
     \ /
      Last update: 2021-01-05 13:28    [W:4.085 / U:0.004 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site