]> git.baikalelectronics.ru Git - kernel.git/commit
xdp: fix leak of IDA cyclic id if rhashtable_insert_slow fails
authorJesper Dangaard Brouer <brouer@redhat.com>
Tue, 18 Jun 2019 13:05:22 +0000 (15:05 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 19 Jun 2019 15:23:13 +0000 (11:23 -0400)
commit775760876139e7a43c1fc227d4b9d3d4ad293361
treef111f568dc52b34a094dbdc8116c6c5c245026ae
parent1a6c6bbaf39c0129013d7e523a35b329c38d4823
xdp: fix leak of IDA cyclic id if rhashtable_insert_slow fails

Fix error handling case, where inserting ID with rhashtable_insert_slow
fails in xdp_rxq_info_reg_mem_model, which leads to never releasing the IDA
ID, as the lookup in xdp_rxq_info_unreg_mem_model fails and thus
ida_simple_remove() is never called.

Fix by releasing ID via ida_simple_remove(), and mark xdp_rxq->mem.id with
zero, which is already checked in xdp_rxq_info_unreg_mem_model().

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/xdp.c