Re: [PATCH bpf] libbpf: always NULL out pobj in bpf_prog_load_xattr

2019-05-07 Thread Lorenz Bauer
On Thu, 2 May 2019 at 17:03, Martin Lau wrote: > > On Thu, May 02, 2019 at 11:49:32AM -0400, Lorenz Bauer wrote: > > Currently, code like the following segfaults if bpf_prog_load_xattr > > returns an error: > > > > struct bpf_object *obj; > > > > err = bpf_prog_load_xattr(&attr, &obj, &pro

Re: [PATCH bpf] libbpf: always NULL out pobj in bpf_prog_load_xattr

2019-05-02 Thread Martin Lau
On Thu, May 02, 2019 at 11:49:32AM -0400, Lorenz Bauer wrote: > Currently, code like the following segfaults if bpf_prog_load_xattr > returns an error: > > struct bpf_object *obj; > > err = bpf_prog_load_xattr(&attr, &obj, &prog_fd); > bpf_object__close(obj); This is a bug. err shoul

[PATCH bpf] libbpf: always NULL out pobj in bpf_prog_load_xattr

2019-05-02 Thread Lorenz Bauer
Currently, code like the following segfaults if bpf_prog_load_xattr returns an error: struct bpf_object *obj; err = bpf_prog_load_xattr(&attr, &obj, &prog_fd); bpf_object__close(obj); if (err) ... Unconditionally reset pobj to NULL at the start of the function to fix this