]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
libbpf: Restore umem state after socket create failure
authorCiara Loftus <ciara.loftus@intel.com>
Wed, 31 Mar 2021 06:12:17 +0000 (06:12 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 1 Apr 2021 21:45:43 +0000 (14:45 -0700)
commit43f1bc1efff16f553dd573d02eb7a15750925568
tree808d355c9f45a74bbf32179dd180107495b51166
parentdf662016310aa4475d7986fd726af45c8fe4f362
libbpf: Restore umem state after socket create failure

If the call to xsk_socket__create fails, the user may want to retry the
socket creation using the same umem. Ensure that the umem is in the
same state on exit if the call fails by:
1. ensuring the umem _save pointers are unmodified.
2. not unmapping the set of umem rings that were set up with the umem
during xsk_umem__create, since those maps existed before the call to
xsk_socket__create and should remain in tact even in the event of
failure.

Fixes: 2f6324a3937f ("libbpf: Support shared umems between queues and devices")
Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20210331061218.1647-3-ciara.loftus@intel.com
tools/lib/bpf/xsk.c