[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a3397e41-7e57-d4c2-96e0-427d9386444a@canonical.com>
Date: Fri, 13 Jul 2018 16:13:30 +0100
From: Colin Ian King <colin.king@...onical.com>
To: Dan Carpenter <dan.carpenter@...cle.com>,
Alexei Starovoitov <ast@...nel.org>
Cc: Daniel Borkmann <daniel@...earbox.net>, netdev@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH 1/2] samples: bpf: ensure that we don't load over
MAX_PROGS programs
On 13/07/18 16:11, Dan Carpenter wrote:
> I can't see that we check prog_cnt to ensure it doesn't go over
> MAX_PROGS.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
>
> diff --git a/samples/bpf/bpf_load.c b/samples/bpf/bpf_load.c
> index 89161c9ed466..904e775d1a44 100644
> --- a/samples/bpf/bpf_load.c
> +++ b/samples/bpf/bpf_load.c
> @@ -107,6 +107,9 @@ static int load_and_attach(const char *event, struct bpf_insn *prog, int size)
> return -1;
> }
>
> + if (prog_cnt == MAX_PROGS)
> + return -1;
> +
Should that be "if (prog_cnt >= MAX_PROGS)" ?
> fd = bpf_load_program(prog_type, prog, insns_cnt, license, kern_version,
> bpf_log_buf, BPF_LOG_BUF_SIZE);
> if (fd < 0) {
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
Powered by blists - more mailing lists