]> git.baikalelectronics.ru Git - kernel.git/commit
xdp: fix possible cq entry leak
authorIlya Maximets <i.maximets@samsung.com>
Thu, 4 Jul 2019 14:25:03 +0000 (17:25 +0300)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 12 Jul 2019 12:54:57 +0000 (14:54 +0200)
commit74bed4e284d74ee4168b36c5f06434d72df28f6b
treebe8b1b96c494923785d8a8de31cb84e4d0e27d49
parenta6f430d3e77e49fcbac05f563076e4e2f544fc2a
xdp: fix possible cq entry leak

Completion queue address reservation could not be undone.
In case of bad 'queue_id' or skb allocation failure, reserved entry
will be leaked reducing the total capacity of completion queue.

Fix that by moving reservation to the point where failure is not
possible. Additionally, 'queue_id' checking moved out from the loop
since there is no point to check it there.

Fixes: b053263a3f77 ("xsk: support for Tx")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Björn Töpel <bjorn.topel@intel.com>
Tested-by: William Tu <u9012063@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
net/xdp/xsk.c