]> git.ipfire.org Git - thirdparty/iproute2.git/commit
lib: bpf_legacy: avoid to pass invalid argument to close()
authorAndrea Claudi <aclaudi@redhat.com>
Sat, 1 May 2021 17:05:45 +0000 (19:05 +0200)
committerDavid Ahern <dsahern@kernel.org>
Thu, 6 May 2021 14:43:54 +0000 (14:43 +0000)
commit3296d4fe773107e52f2e5a7b9244ad7073f36f5a
tree58051de03985c50d7dcbbed70dcc87ed80448cbe
parenta2f1f66075c830a3c67544c7f36ed4411d64cd86
lib: bpf_legacy: avoid to pass invalid argument to close()

In function bpf_obj_open, if bpf_fetch_prog_arg() return an error, we
end up in the out: path with a negative value for fd, and pass it to
close.

Avoid this checking for fd to be positive.

Fixes: 32e93fb7f66d ("{f,m}_bpf: allow for sharing maps")
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
lib/bpf_legacy.c