]> git.baikalelectronics.ru Git - kernel.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)
commitcc454b67874724cf31e1c89c60ea796428ba711b
tree808d355c9f45a74bbf32179dd180107495b51166
parent3b4fc7956884a82501e67c9d7fbf73f87a964317
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: d31988fd4fb8 ("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