bpf: libbpf: retry map creation without the name
authorStanislav Fomichev <sdf@google.com>
Mon, 19 Nov 2018 22:49:01 +0000 (14:49 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Feb 2019 18:47:00 +0000 (19:47 +0100)
commitf6d66139f8877d0db723ad767315525aa1d2b383
treeea2193f236ac213fac9a3454a38468aca34fba75
parent0857b8439b6b9ce388e47652420ac083ea5f08d6
bpf: libbpf: retry map creation without the name

[ Upstream commit 23499442c319412aa8e54e7a939e2eb531bdd77d ]

Since commit 88cda1c9da02 ("bpf: libbpf: Provide basic API support
to specify BPF obj name"), libbpf unconditionally sets bpf_attr->name
for maps. Pre v4.14 kernels don't know about map names and return an
error about unexpected non-zero data. Retry sys_bpf without a map
name to cover older kernels.

v2 changes:
* check for errno == EINVAL as suggested by Daniel Borkmann

Signed-off-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/lib/bpf/bpf.c