[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1471450562.29842.6.camel@edumazet-glaptop3.roam.corp.google.com>
Date: Wed, 17 Aug 2016 09:16:02 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: Daniel Mack <daniel@...que.org>
Cc: htejun@...com, daniel@...earbox.net, ast@...com,
davem@...emloft.net, kafai@...com, fw@...len.de,
pablo@...filter.org, harald@...hat.com, netdev@...r.kernel.org
Subject: Re: [RFC PATCH 3/5] bpf: add BPF_PROG_ATTACH and BPF_PROG_DETACH
commands
On Wed, 2016-08-17 at 16:00 +0200, Daniel Mack wrote:
> + progp = is_ingress ? &cgrp->bpf_ingress : &cgrp->bpf_egress;
> +
> + rcu_read_lock();
> + old_prog = rcu_dereference(*progp);
> + rcu_assign_pointer(*progp, prog);
> +
> + if (old_prog)
> + bpf_prog_put(old_prog);
> +
> + rcu_read_unlock();
This is a bogus locking strategy.
You do not want to use rcu_read_lock()/rcu_read_unlock() here, but
appropriate writer exclusion (a mutex probably, or a spinlock)
Then use rcu_dereference_protected() instead of rcu_dereference(*progp);
Powered by blists - more mailing lists