[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzbRpTrbFWDRD8TfWBDO6_4jZyseX08Q8emZz4qPDA4QqA@mail.gmail.com>
Date: Mon, 1 Jun 2020 15:31:05 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Jakub Sitnicki <jakub@...udflare.com>
Cc: bpf <bpf@...r.kernel.org>, Networking <netdev@...r.kernel.org>,
kernel-team@...udflare.com, Lorenz Bauer <lmb@...udflare.com>
Subject: Re: [PATCH bpf-next v2 05/12] bpf, cgroup: Return ENOLINK for
auto-detached links on update
On Sun, May 31, 2020 at 1:29 AM Jakub Sitnicki <jakub@...udflare.com> wrote:
>
> Failure to update a bpf_link because it has been auto-detached by a dying
> cgroup currently results in EINVAL error, even though the arguments passed
> to bpf() syscall are not wrong.
>
> bpf_links attaching to netns in this case will return ENOLINK, which
> carries the message that the link is no longer attached to anything.
>
> Change cgroup bpf_links to do the same to keep the uAPI errors consistent.
>
> Fixes: 0c991ebc8c69 ("bpf: Implement bpf_prog replacement for an active bpf_cgroup_link")
> Suggested-by: Lorenz Bauer <lmb@...udflare.com>
> Signed-off-by: Jakub Sitnicki <jakub@...udflare.com>
> ---
Looks good, thanks!
Acked-by: Andrii Nakryiko <andriin@...com>
> kernel/bpf/cgroup.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c
> index 5c0e964105ac..fdf7836750a3 100644
> --- a/kernel/bpf/cgroup.c
> +++ b/kernel/bpf/cgroup.c
> @@ -595,7 +595,7 @@ static int cgroup_bpf_replace(struct bpf_link *link, struct bpf_prog *new_prog,
> mutex_lock(&cgroup_mutex);
> /* link might have been auto-released by dying cgroup, so fail */
> if (!cg_link->cgroup) {
> - ret = -EINVAL;
> + ret = -ENOLINK;
> goto out_unlock;
> }
> if (old_prog && link->prog != old_prog) {
> --
> 2.25.4
>
Powered by blists - more mailing lists