On 16/08/18 17:44, Petar Penkov wrote:
> From: Petar Penkov <ppen...@google.com>
>
> Adds a hook for programs of type BPF_PROG_TYPE_FLOW_DISSECTOR and
> attach type BPF_FLOW_DISSECTOR that is executed in the flow dissector
> path. The BPF program is kept as a global variable so it is
> accessible to all flow dissectors.
>
> Signed-off-by: Petar Penkov <ppen...@google.com>
> Signed-off-by: Willem de Bruijn <will...@google.com>
> ---

This looks really great.

> +int skb_flow_dissector_bpf_prog_detach(const union bpf_attr *attr)
> +{
> +     struct bpf_prog *attached;
> +
> +     mutex_lock(&flow_dissector_mutex);
> +     attached = rcu_dereference_protected(flow_dissector_prog,
> +                                          
> lockdep_is_held(&flow_dissector_mutex));
> +     if (!flow_dissector_prog) {
> +             mutex_unlock(&flow_dissector_mutex);
> +             return -EINVAL;
Wouldn't -ENOENT be more usual here (as the counterpart to -EEXIST in
 the skb_flow_dissector_bpf_prog_attach() version just above)?

-Ed

Reply via email to